SlideShare una empresa de Scribd logo
1 de 17
Andy Gibson
School of Applied Computing
University of Dundee


                              Email: argibson86@gmail.com
                              Blog: http://www.andy-gibson.co.uk
                              Twitter: ARGibson
Final year BSc Applied Computing

     Graduate in June


    .NET developer for both web and desktop


      ASP.NET MVC
    
     jQuery


    Enjoy playing with new technology

Exhibit A

  Name:
  John Resig

  Employer:
  Mozilla Corporation

  Role:
  JavaScript Evangelist

  Creator of:
      • jQuery
      • Sizzle Selector Engine
      • TestSwarm
      • The Google Address Translator
What is jQuery?
    A JavaScript framework



    Lightweight (~19k minified & Gzipped)



    Simplifies and encapsulates monotonous JS

        Boiler plate code
    


    Uses no browser sniffing under the hood!

     Object detection instead
Out of the Box

    Selector Engine (Sizzle)


    DOM Manipulation & Traversal


    Wrapped Set / Chaining


    Event Model


    AJAX


    Effects & Animations


    Extensibility

An Example – Zebra Stripes


         Header A   Header B   Header C   Header D
         5          A          True       #000000
         10         B          False      #333333
         15         C          True       #666666
Odd                                                  Even
         20         D          True       #999999
         25         E          False      #AAAAAA
         30         F          False      #CCCCCC
         35         G          False      #FFFFFF
The DOM JavaScript Way
function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode(quot;classquot;) != null) {
          result = obj.getAttributeNode(quot;classquot;).value;
     }
     return result;
                                                                      Zebra stripe code from
  }
function stripe(id) {
                                                                          A List Apart
    var even = false;
    var evenColor = arguments[1] ? arguments[1] : quot;#fffquot;;
    var oddColor = arguments[2] ? arguments[2] : quot;#eeequot;;
    var table = document.getElementById(id);
    if (! table) { return; }
    var tbodies = table.getElementsByTagName(quot;tbodyquot;);
    for (var h = 0; h < tbodies.length; h++) {
       var trs = tbodies[h].getElementsByTagName(quot;trquot;);
       for (var i = 0; i < trs.length; i++) {
                                                                      35 Lines of code!
         if (! hasClass(trs[i]) &&
             ! trs[i].style.backgroundColor) {
           var tds = trs[i].getElementsByTagName(quot;tdquot;);

                 for (var j = 0; j < tds.length; j++) {
                   var mytd = tds[j];
                   if (! hasClass(mytd) &&
                       ! mytd.style.backgroundColor) {



                                                                        1.1 kb
                         mytd.style.backgroundColor =
                           even ? evenColor : oddColor;
                     }
                 }
             }
         }
     }
 }
             Source: http://www.alistapart.com/articles/zebratables
The jQuery Way
Add a CSS class to all even table rows:
$(“table tr:nth-child(even)”).addClass(“striped”);
                           Isn’t that a CSS 3 selector?
                                                      It sure is!
Or, set the background-color styles:
$(“table tr:nth-child(even)”).css(“background-color”, “#fff”);
$(“table tr:nth-child(odd)”).css(“background-color”, “#eee”);



                                                            129bytes
                                                            51 bytes
   Zebra stripe code in
                                2 Linesof code!
                                1 Line of code!
         jQuery
Browser Compatibility
    It’s not all a walk in the park!

        You at the back, yes you, pay attention!
    




     Firefox 1.5+      Internet Explorer 6+         Safari 3+             Opera 9+
                                              (Konquer0r, Chrome, etc.)


          jQuery will work on other browsers / versions
                  BUT there are known issues!
                Compatibility testing: http://jquery.com/test/
Syntax

                $ as an alias to the jQuery object
    Provides

        Can avoid conflicts by using $.noConflict()
    


    Most operations return a jQuery object

        Operations are applied to the same set of elements
    
        Allows chaining
    
Available as both a web
 site an an Adobe Air
      application




http://api.jquery.com
Visual Studio 2008
  
       Ships with ASP.NET MVC
       InteliSense through an update and -vsdoc.js files*

      Eclipse
  
       Web Platform Tools Support**

      NetBeans
  
       Code completion for JS libraries out of the box
* http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx
** http://www.langtags.com/jquerywtp/
jQuery In Action:
Published by Manning
ISBN: 978-1933-988351




   Learning jQuery 1.3:
          Published by Packt
   ISBN: 978-1847-196705
Andy Gibson:
                                       Email:
          1.3.2                        argibson86@gmail.com
   http://jquery.com
   http://api.jquery.com
                                       Web:
   http://ui.jquery.com
                                       http://www.andy-gibson.co.uk
   http://plugins.jquery.com


      Thank you for                    Twitter:
        coming
                                       http://twitter.com/ARGibson

                       WebDD ‘09: 18th April Microsoft Campus, Reading
                       DDD Scotland: 2nd May GCU Glasgow
                       DDD South West: 23rd May Taunton, Somerset

Más contenido relacionado

La actualidad más candente

Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web frameworktaggg
 
How to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainHow to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainCodemotion Tel Aviv
 
스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내Jung Kim
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Dotan Dimet
 
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]Guillermo Paz
 
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Vagmi Mudumbai
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
Writing Your App Swiftly
Writing Your App SwiftlyWriting Your App Swiftly
Writing Your App SwiftlySommer Panage
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 
Expoによるモバイルアプリ開発入門
Expoによるモバイルアプリ開発入門Expoによるモバイルアプリ開発入門
Expoによるモバイルアプリ開発入門Takayuki Goto
 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with DjangoSimon Willison
 
Javascript and Jquery: The connection between
Javascript and Jquery: The connection betweenJavascript and Jquery: The connection between
Javascript and Jquery: The connection betweenClint LaForest
 
Writing Clean Code in Swift
Writing Clean Code in SwiftWriting Clean Code in Swift
Writing Clean Code in SwiftDerek Lee Boire
 
Js testing
Js testingJs testing
Js testingMaslowB
 
GCRC 2014 - The Dark Side of Ruby
GCRC 2014 - The Dark Side of RubyGCRC 2014 - The Dark Side of Ruby
GCRC 2014 - The Dark Side of RubyGautam Rege
 

La actualidad más candente (20)

Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
How to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainHow to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrain
 
스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내
 
Web Vector Graphics
Web Vector GraphicsWeb Vector Graphics
Web Vector Graphics
 
The Code
The CodeThe Code
The Code
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]
 
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
Swift for-rubyists
Swift for-rubyistsSwift for-rubyists
Swift for-rubyists
 
Mojolicious on Steroids
Mojolicious on SteroidsMojolicious on Steroids
Mojolicious on Steroids
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Writing Your App Swiftly
Writing Your App SwiftlyWriting Your App Swiftly
Writing Your App Swiftly
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Expoによるモバイルアプリ開発入門
Expoによるモバイルアプリ開発入門Expoによるモバイルアプリ開発入門
Expoによるモバイルアプリ開発入門
 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with Django
 
Javascript and Jquery: The connection between
Javascript and Jquery: The connection betweenJavascript and Jquery: The connection between
Javascript and Jquery: The connection between
 
Writing Clean Code in Swift
Writing Clean Code in SwiftWriting Clean Code in Swift
Writing Clean Code in Swift
 
Js testing
Js testingJs testing
Js testing
 
GCRC 2014 - The Dark Side of Ruby
GCRC 2014 - The Dark Side of RubyGCRC 2014 - The Dark Side of Ruby
GCRC 2014 - The Dark Side of Ruby
 

Destacado

Turn Your Customer Experience into Cash Presentation
Turn Your Customer Experience into Cash PresentationTurn Your Customer Experience into Cash Presentation
Turn Your Customer Experience into Cash PresentationCaptivated Customers LLC
 
Calendário de Datas Comemorativas 2012
Calendário de Datas Comemorativas 2012Calendário de Datas Comemorativas 2012
Calendário de Datas Comemorativas 2012All_in
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Rob Windsor
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewRob Windsor
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchRob Windsor
 
Cambodia - more than temples
Cambodia - more than templesCambodia - more than temples
Cambodia - more than templesFred Meng
 

Destacado (7)

Turn Your Customer Experience into Cash Presentation
Turn Your Customer Experience into Cash PresentationTurn Your Customer Experience into Cash Presentation
Turn Your Customer Experience into Cash Presentation
 
LinkedIn Profiles That Mean Business
LinkedIn Profiles That Mean BusinessLinkedIn Profiles That Mean Business
LinkedIn Profiles That Mean Business
 
Calendário de Datas Comemorativas 2012
Calendário de Datas Comemorativas 2012Calendário de Datas Comemorativas 2012
Calendário de Datas Comemorativas 2012
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
 
Cambodia - more than temples
Cambodia - more than templesCambodia - more than temples
Cambodia - more than temples
 

Similar a An Introduction To jQuery

JavaOne 2009 - 2d Vector Graphics in the browser with Canvas and SVG
JavaOne 2009 -  2d Vector Graphics in the browser with Canvas and SVGJavaOne 2009 -  2d Vector Graphics in the browser with Canvas and SVG
JavaOne 2009 - 2d Vector Graphics in the browser with Canvas and SVGPatrick Chanezon
 
Efficient JavaScript Development
Efficient JavaScript DevelopmentEfficient JavaScript Development
Efficient JavaScript Developmentwolframkriesing
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Chris Alfano
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend TestingNeil Crosby
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescriptDavid Furber
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Techvincent_scheib
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebMikel Torres Ugarte
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous MerbMatt Todd
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Patrick Chanezon
 
JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4alexsaves
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureSimon Willison
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018Codemotion
 
RubyMotion
RubyMotionRubyMotion
RubyMotionMark
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertextfrankieroberto
 
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...BradNeuberg
 

Similar a An Introduction To jQuery (20)

JavaOne 2009 - 2d Vector Graphics in the browser with Canvas and SVG
JavaOne 2009 -  2d Vector Graphics in the browser with Canvas and SVGJavaOne 2009 -  2d Vector Graphics in the browser with Canvas and SVG
JavaOne 2009 - 2d Vector Graphics in the browser with Canvas and SVG
 
Efficient JavaScript Development
Efficient JavaScript DevelopmentEfficient JavaScript Development
Efficient JavaScript Development
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
Python, WebRTC and You (v2)
Python, WebRTC and You (v2)Python, WebRTC and You (v2)
Python, WebRTC and You (v2)
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
 
JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
 
Working With Canvas
Working With CanvasWorking With Canvas
Working With Canvas
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
 

Último

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Último (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

An Introduction To jQuery

  • 1. Andy Gibson School of Applied Computing University of Dundee Email: argibson86@gmail.com Blog: http://www.andy-gibson.co.uk Twitter: ARGibson
  • 2. Final year BSc Applied Computing   Graduate in June .NET developer for both web and desktop  ASP.NET MVC   jQuery Enjoy playing with new technology 
  • 3.
  • 4. Exhibit A Name: John Resig Employer: Mozilla Corporation Role: JavaScript Evangelist Creator of: • jQuery • Sizzle Selector Engine • TestSwarm • The Google Address Translator
  • 5. What is jQuery? A JavaScript framework  Lightweight (~19k minified & Gzipped)  Simplifies and encapsulates monotonous JS  Boiler plate code  Uses no browser sniffing under the hood!   Object detection instead
  • 6. Out of the Box Selector Engine (Sizzle)  DOM Manipulation & Traversal  Wrapped Set / Chaining  Event Model  AJAX  Effects & Animations  Extensibility 
  • 7. An Example – Zebra Stripes Header A Header B Header C Header D 5 A True #000000 10 B False #333333 15 C True #666666 Odd Even 20 D True #999999 25 E False #AAAAAA 30 F False #CCCCCC 35 G False #FFFFFF
  • 8. The DOM JavaScript Way function hasClass(obj) { var result = false; if (obj.getAttributeNode(quot;classquot;) != null) { result = obj.getAttributeNode(quot;classquot;).value; } return result; Zebra stripe code from } function stripe(id) { A List Apart var even = false; var evenColor = arguments[1] ? arguments[1] : quot;#fffquot;; var oddColor = arguments[2] ? arguments[2] : quot;#eeequot;; var table = document.getElementById(id); if (! table) { return; } var tbodies = table.getElementsByTagName(quot;tbodyquot;); for (var h = 0; h < tbodies.length; h++) { var trs = tbodies[h].getElementsByTagName(quot;trquot;); for (var i = 0; i < trs.length; i++) { 35 Lines of code! if (! hasClass(trs[i]) && ! trs[i].style.backgroundColor) { var tds = trs[i].getElementsByTagName(quot;tdquot;); for (var j = 0; j < tds.length; j++) { var mytd = tds[j]; if (! hasClass(mytd) && ! mytd.style.backgroundColor) { 1.1 kb mytd.style.backgroundColor = even ? evenColor : oddColor; } } } } } } Source: http://www.alistapart.com/articles/zebratables
  • 9. The jQuery Way Add a CSS class to all even table rows: $(“table tr:nth-child(even)”).addClass(“striped”); Isn’t that a CSS 3 selector? It sure is! Or, set the background-color styles: $(“table tr:nth-child(even)”).css(“background-color”, “#fff”); $(“table tr:nth-child(odd)”).css(“background-color”, “#eee”); 129bytes 51 bytes Zebra stripe code in 2 Linesof code! 1 Line of code! jQuery
  • 10. Browser Compatibility It’s not all a walk in the park!  You at the back, yes you, pay attention!  Firefox 1.5+ Internet Explorer 6+ Safari 3+ Opera 9+ (Konquer0r, Chrome, etc.) jQuery will work on other browsers / versions BUT there are known issues! Compatibility testing: http://jquery.com/test/
  • 11. Syntax $ as an alias to the jQuery object Provides  Can avoid conflicts by using $.noConflict()  Most operations return a jQuery object  Operations are applied to the same set of elements  Allows chaining 
  • 12.
  • 13.
  • 14. Available as both a web site an an Adobe Air application http://api.jquery.com
  • 15. Visual Studio 2008   Ships with ASP.NET MVC  InteliSense through an update and -vsdoc.js files* Eclipse   Web Platform Tools Support** NetBeans   Code completion for JS libraries out of the box * http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx ** http://www.langtags.com/jquerywtp/
  • 16. jQuery In Action: Published by Manning ISBN: 978-1933-988351 Learning jQuery 1.3: Published by Packt ISBN: 978-1847-196705
  • 17. Andy Gibson: Email: 1.3.2 argibson86@gmail.com  http://jquery.com  http://api.jquery.com Web:  http://ui.jquery.com http://www.andy-gibson.co.uk  http://plugins.jquery.com Thank you for Twitter: coming http://twitter.com/ARGibson WebDD ‘09: 18th April Microsoft Campus, Reading DDD Scotland: 2nd May GCU Glasgow DDD South West: 23rd May Taunton, Somerset