SlideShare uma empresa Scribd logo
1 de 38
Deepak Gulati
Lead Architect
Cricinfo.com
Agenda
 What is jQuery and why you need it
 Javascript: Advanced Basics
 DOM Traversal and Manipulation Using jQuery
 jQuery’s Event Handling Model
 Ajax and jQuery
 Special Effects Using jQuery and Plugins
 jQuery Utility Functions
quot;The DOM is a Messquot;
 DOM traversal without jQuery
    getElementById
    getElementsByName
    getElementsByTagName
    getElementsByClassName
    querySelectorAll
 Verbose
 Different/buggy across browsers
getElementById
 IE and older versions of Opera returning
 elements with a name == id
getElementsByTagName
 “*” returns no elements on <object> elements
 in IE 7
 .length gets overwritten in IE if an element with
 an ID=quot;lengthquot; is found
getElementsByClassName
 Available in Firefox 3, Safari 3, Opera 9.6
 Opera doesn’t match a second-specified class
 (e.g. class=quot;a bquot;, b isn’t found)
querySelectorAll
 Relatively very new: In Firefox 3.1, Safari
 3.1, Opera 10, IE 8
 Doesn’t exist in quirks mode, in IE 8
 Safari 3.2 can’t match uppercase characters in
 quirks mode
 #id doesn’t match in XML documents
Enter jQuery
 Fast, lightweight, cross-browser Javascript
 library
    ~19 kb when minified+gzipped
    Excellent support for most browsers – including
    IE6, IE7, IE8, FF2, FF3, Safari, Chrome and Opera
 Open source and part of official Microsoft Ajax
 stack
    Started as a one-person effort in Jan 2006 John
    Resig. Now a team of contributors runs it.
Browser Support Grid

           IE    Firefox   Safari   Opera   Chrome

Previous
           6.0     2.0       3.0      9.5

Current    7.0     3.0       3.2      9.6    1.0

Next       8.0     3.1       4.0     10.0    2.0
Some advanced basics
 Anonymous functions
 Functions as objects
 “Length” of a Function
 JSON
Demo: Javascript – Advanced Basics
$ - one function to bind them all
 $ is an alias for jQuery function
 It accepts a selector string
 It returns a “wrapper”
    A special Javascript object
    Contains an array of elements that match selector
    Has a number of useful methods that act on a
    group of elements
A selector can be
 #id, element
 .class
 And others (we’ll see more shortly)
 You can do things with values returned by
 selectors
    Hide/Show
    Change html
    Change attributes
    Animate
Demo: Hello World
Selector Syntax – Basic Filters
 :first, :last
 :not(selector)
 :even, :odd
 :eq(index), :gt(index), :lt(index)
 :header
 :animated
Selector Syntax - Content Filters
 :contains
 :empty
 :has(selector)
 :parent
Selector Syntax – Attribute Filters
 [attribute]
 [attribute=value]
 [attribute!=value]
 [attribute^=value]
 [attribute$=value]
 [attribute*=value]
 [attributeFilter1][attributeFilter2][attributeFilter
 N]
Selector Syntax - Heirarchy
 Ancestor Descendant
 Parent > Child
 Prev + Next
 Prev ~ Siblings
Selector Syntax - Child Filters
 :nth-child(index/even/odd/equation)
 :first-child
 :last-child
 :only-child
Selector Syntax – Forms
 :input
 :text, :password
 :radio, :checkbox
 :submit, :reset, :button
 :image
 :file
 :hidden
Selector Syntax: Form Filters
 :enabled
 :disabled
 :checked
 :selected
Demo:
1. More Selectors
2. Fun with Checkboxes
Event handling using jQuery
 jQuery “unifies” event handling models across
 browsers
 Allows you to cleanly separate the design of a
 page from its behavior
Event handling using jQuery
 $(document).ready(fn) binds a function to be
 executed whenerver DOM is ready
    Can have multiple $(document).ready
    Executed in the order they were added
 bind(type, [data], fn) associates events with
 elements. unbind(type, fn) does the opposite
 one(type, [data], fn) same as bind but executes
 the handler only once
 Shortcuts exist for common events like click
Ajax and jQuery
 Several ways to Ajax depending on scenario
 .load(url, [data], [callback])
    loads html from a remote url and injects it into
    dom
    Very easy to use
Ajax and jQuery
 jQuery.get(url, [data], [callback], [type])
    allows you to specify key value pairs that are sent
    using GET
    type sends that correct data type to your callback
    and can be one of xml, html, script, json, jsonp or
    text
 jQuery.post(url, [data], [callback], [type])
    uses POST to send data to the url
Ajax and jQuery
 jQuery.getJSON(url, [data], [callback])
    Specialized for loading JSON data across domains
    Used with jsonp callback
 jQuery.getScript(url, [callback])
    Loads and executes scripts
    Useful for “delay-loading” scripts
Ajax and jQuery
 jQuery.ajax(options)
    Gives you more control over your ajax calls
    Can monitor and ajax call using events
      ajaxStart
      ajaxSend, ajaxSuccess, ajaxError, ajaxComplete
      ajaxStop
    Can use jQuery.ajaxSetup(options) to specify
    options for jQuery.ajax once
Demo: jQuery and AJAX
Effects Using jQuery and Plugins
 jQuery has built-in functions that allows you to
 hide/show/animate elements
    show() .hide()
    slideDown(speed, [callback])
    slideUp(speed, [callback])
    fadeIn(speed, [callback]), fadeOut(speed, [callback]
    ), fadeTo(speed, [callback])
 animate allows you a fine-grained control over
 animations
Effects Using jQuery and Plugins
 jQuery is extensible using a plugin model
    Hundreds of plugins exist
    Writing one yourself is easy too!
 Plugins can
    Enhance UIs (auto-complete, calendars, sort tables
    etc.)
    Provide custom animations (advanced
    sliding, fading)
    Provide utility functions (cookie handling, JSON
    handling)
Demo: Animations and Plugins
jQuery Utility Functions
 Browser detection
    jQuery.browser, jQuery.browser.version
 Iterator
    jQuery.each(object, callback)
 String handling
    jQuery.trim(str)
 Array handling
    jQuery.grep(array, callback, [invert])
    jQuery.map(array, callback)
jQuery and Microsoft
 jQuery now part of official ASP.NET stack
 Can download a ‘development’ version that
 adds intellisense to VS
 Ships with ASP.NET MVC
 Will possibly ship with future versions of Visual
 Studio
Demo: jQuery and Visual Studio
Summary
 Cross browser Javascript programming tedious
 jQuery makes it easy to write compact, reliable
 cross-browser code
 Robust support for AJAX
 100s of 3rd party plugins
 Vibrant community
Resources
 Online:
    Documentation: docs.jquery.com
    Blogs: learningjquery.com, ejohn.org
    deepakg.com/prog/
 Offline
    Manning Press: jQuery In Action
    Manning Press: Secrets of Javascript Ninjas
    Packt Publishing: Learning jQuery
    Packt Publishing: jQuery Reference Guide
J Query   The Write Less Do More Javascript Library

Mais conteúdo relacionado

Mais procurados

jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events WebStackAcademy
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009Remy Sharp
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do MoreRemy Sharp
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
 
jQuery - Chapter 5 - Ajax
jQuery - Chapter 5 -  AjaxjQuery - Chapter 5 -  Ajax
jQuery - Chapter 5 - AjaxWebStackAcademy
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETJames Johnson
 

Mais procurados (20)

jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
J query
J queryJ query
J query
 
J query1
J query1J query1
J query1
 
J query training
J query trainingJ query training
J query training
 
jQuery Effects
jQuery EffectsjQuery Effects
jQuery Effects
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
jQuery in 15 minutes
jQuery in 15 minutesjQuery in 15 minutes
jQuery in 15 minutes
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
jQuery - Chapter 5 - Ajax
jQuery - Chapter 5 -  AjaxjQuery - Chapter 5 -  Ajax
jQuery - Chapter 5 - Ajax
 
Jquery
JqueryJquery
Jquery
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NET
 

Destaque (20)

Javascript & jQuery: A pragmatic introduction
Javascript & jQuery: A pragmatic introductionJavascript & jQuery: A pragmatic introduction
Javascript & jQuery: A pragmatic introduction
 
Html forms
Html formsHtml forms
Html forms
 
04 Advanced Javascript
04 Advanced Javascript04 Advanced Javascript
04 Advanced Javascript
 
jQuery filters - Part 1
jQuery filters - Part 1jQuery filters - Part 1
jQuery filters - Part 1
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
JQuery - Effect - Animate method
JQuery - Effect - Animate methodJQuery - Effect - Animate method
JQuery - Effect - Animate method
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 
html tags
html tagshtml tags
html tags
 
jQuery Selectors
jQuery SelectorsjQuery Selectors
jQuery Selectors
 
Event handling using jQuery
Event handling using jQueryEvent handling using jQuery
Event handling using jQuery
 
Html frames
Html framesHtml frames
Html frames
 
Html tags or elements
Html tags or elementsHtml tags or elements
Html tags or elements
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
List of html tags
List of html tagsList of html tags
List of html tags
 
Html Basic Tags
Html Basic TagsHtml Basic Tags
Html Basic Tags
 
Html frames
Html framesHtml frames
Html frames
 
Html forms
Html formsHtml forms
Html forms
 
HTML Frameset & Inline Frame
HTML Frameset & Inline FrameHTML Frameset & Inline Frame
HTML Frameset & Inline Frame
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
Html Frames
Html FramesHtml Frames
Html Frames
 

Semelhante a J Query The Write Less Do More Javascript Library

Semelhante a J Query The Write Less Do More Javascript Library (20)

jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaz
 
jQuery - Chapter 3 - Effects
jQuery - Chapter 3 - Effects  jQuery - Chapter 3 - Effects
jQuery - Chapter 3 - Effects
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
J Query
J QueryJ Query
J Query
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
J query intro_29thsep_alok
J query intro_29thsep_alokJ query intro_29thsep_alok
J query intro_29thsep_alok
 
Jqueryppt (1)
Jqueryppt (1)Jqueryppt (1)
Jqueryppt (1)
 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Jquery
JqueryJquery
Jquery
 
jQuery with javascript training by Technnovation Labs
jQuery with javascript training by Technnovation LabsjQuery with javascript training by Technnovation Labs
jQuery with javascript training by Technnovation Labs
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New Evolution
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 

Mais de rsnarayanan

Kevin Ms Web Platform
Kevin Ms Web PlatformKevin Ms Web Platform
Kevin Ms Web Platformrsnarayanan
 
Harish Understanding Aspnet
Harish Understanding AspnetHarish Understanding Aspnet
Harish Understanding Aspnetrsnarayanan
 
Harish Aspnet Dynamic Data
Harish Aspnet Dynamic DataHarish Aspnet Dynamic Data
Harish Aspnet Dynamic Datarsnarayanan
 
Harish Aspnet Deployment
Harish Aspnet DeploymentHarish Aspnet Deployment
Harish Aspnet Deploymentrsnarayanan
 
Whats New In Sl3
Whats New In Sl3Whats New In Sl3
Whats New In Sl3rsnarayanan
 
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...rsnarayanan
 
Advanced Silverlight
Advanced SilverlightAdvanced Silverlight
Advanced Silverlightrsnarayanan
 
Occasionally Connected Systems
Occasionally Connected SystemsOccasionally Connected Systems
Occasionally Connected Systemsrsnarayanan
 
Developing Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And ServicesDeveloping Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And Servicesrsnarayanan
 
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...rsnarayanan
 
Ms Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My SqlMs Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My Sqlrsnarayanan
 
Windows 7 For Developers
Windows 7 For DevelopersWindows 7 For Developers
Windows 7 For Developersrsnarayanan
 
What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1rsnarayanan
 
Ux For Developers
Ux For DevelopersUx For Developers
Ux For Developersrsnarayanan
 
A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8rsnarayanan
 
App Arch Guide (Dons)
App Arch Guide (Dons)App Arch Guide (Dons)
App Arch Guide (Dons)rsnarayanan
 

Mais de rsnarayanan (20)

Walther Aspnet4
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
 
Kevin Ms Web Platform
Kevin Ms Web PlatformKevin Ms Web Platform
Kevin Ms Web Platform
 
Harish Understanding Aspnet
Harish Understanding AspnetHarish Understanding Aspnet
Harish Understanding Aspnet
 
Walther Mvc
Walther MvcWalther Mvc
Walther Mvc
 
Harish Aspnet Dynamic Data
Harish Aspnet Dynamic DataHarish Aspnet Dynamic Data
Harish Aspnet Dynamic Data
 
Harish Aspnet Deployment
Harish Aspnet DeploymentHarish Aspnet Deployment
Harish Aspnet Deployment
 
Whats New In Sl3
Whats New In Sl3Whats New In Sl3
Whats New In Sl3
 
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
 
Advanced Silverlight
Advanced SilverlightAdvanced Silverlight
Advanced Silverlight
 
Netcf Gc
Netcf GcNetcf Gc
Netcf Gc
 
Occasionally Connected Systems
Occasionally Connected SystemsOccasionally Connected Systems
Occasionally Connected Systems
 
Developing Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And ServicesDeveloping Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And Services
 
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
 
Ms Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My SqlMs Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My Sql
 
Windows 7 For Developers
Windows 7 For DevelopersWindows 7 For Developers
Windows 7 For Developers
 
What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1
 
Ux For Developers
Ux For DevelopersUx For Developers
Ux For Developers
 
A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8
 
App Arch Guide (Dons)
App Arch Guide (Dons)App Arch Guide (Dons)
App Arch Guide (Dons)
 

Último

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
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
 
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
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
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...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
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...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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
 
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
 

J Query The Write Less Do More Javascript Library

  • 2. Agenda What is jQuery and why you need it Javascript: Advanced Basics DOM Traversal and Manipulation Using jQuery jQuery’s Event Handling Model Ajax and jQuery Special Effects Using jQuery and Plugins jQuery Utility Functions
  • 3. quot;The DOM is a Messquot; DOM traversal without jQuery getElementById getElementsByName getElementsByTagName getElementsByClassName querySelectorAll Verbose Different/buggy across browsers
  • 4. getElementById IE and older versions of Opera returning elements with a name == id
  • 5. getElementsByTagName “*” returns no elements on <object> elements in IE 7 .length gets overwritten in IE if an element with an ID=quot;lengthquot; is found
  • 6. getElementsByClassName Available in Firefox 3, Safari 3, Opera 9.6 Opera doesn’t match a second-specified class (e.g. class=quot;a bquot;, b isn’t found)
  • 7. querySelectorAll Relatively very new: In Firefox 3.1, Safari 3.1, Opera 10, IE 8 Doesn’t exist in quirks mode, in IE 8 Safari 3.2 can’t match uppercase characters in quirks mode #id doesn’t match in XML documents
  • 8. Enter jQuery Fast, lightweight, cross-browser Javascript library ~19 kb when minified+gzipped Excellent support for most browsers – including IE6, IE7, IE8, FF2, FF3, Safari, Chrome and Opera Open source and part of official Microsoft Ajax stack Started as a one-person effort in Jan 2006 John Resig. Now a team of contributors runs it.
  • 9. Browser Support Grid IE Firefox Safari Opera Chrome Previous 6.0 2.0 3.0 9.5 Current 7.0 3.0 3.2 9.6 1.0 Next 8.0 3.1 4.0 10.0 2.0
  • 10. Some advanced basics Anonymous functions Functions as objects “Length” of a Function JSON
  • 11. Demo: Javascript – Advanced Basics
  • 12. $ - one function to bind them all $ is an alias for jQuery function It accepts a selector string It returns a “wrapper” A special Javascript object Contains an array of elements that match selector Has a number of useful methods that act on a group of elements
  • 13. A selector can be #id, element .class And others (we’ll see more shortly) You can do things with values returned by selectors Hide/Show Change html Change attributes Animate
  • 15. Selector Syntax – Basic Filters :first, :last :not(selector) :even, :odd :eq(index), :gt(index), :lt(index) :header :animated
  • 16. Selector Syntax - Content Filters :contains :empty :has(selector) :parent
  • 17. Selector Syntax – Attribute Filters [attribute] [attribute=value] [attribute!=value] [attribute^=value] [attribute$=value] [attribute*=value] [attributeFilter1][attributeFilter2][attributeFilter N]
  • 18. Selector Syntax - Heirarchy Ancestor Descendant Parent > Child Prev + Next Prev ~ Siblings
  • 19. Selector Syntax - Child Filters :nth-child(index/even/odd/equation) :first-child :last-child :only-child
  • 20. Selector Syntax – Forms :input :text, :password :radio, :checkbox :submit, :reset, :button :image :file :hidden
  • 21. Selector Syntax: Form Filters :enabled :disabled :checked :selected
  • 22. Demo: 1. More Selectors 2. Fun with Checkboxes
  • 23. Event handling using jQuery jQuery “unifies” event handling models across browsers Allows you to cleanly separate the design of a page from its behavior
  • 24. Event handling using jQuery $(document).ready(fn) binds a function to be executed whenerver DOM is ready Can have multiple $(document).ready Executed in the order they were added bind(type, [data], fn) associates events with elements. unbind(type, fn) does the opposite one(type, [data], fn) same as bind but executes the handler only once Shortcuts exist for common events like click
  • 25. Ajax and jQuery Several ways to Ajax depending on scenario .load(url, [data], [callback]) loads html from a remote url and injects it into dom Very easy to use
  • 26. Ajax and jQuery jQuery.get(url, [data], [callback], [type]) allows you to specify key value pairs that are sent using GET type sends that correct data type to your callback and can be one of xml, html, script, json, jsonp or text jQuery.post(url, [data], [callback], [type]) uses POST to send data to the url
  • 27. Ajax and jQuery jQuery.getJSON(url, [data], [callback]) Specialized for loading JSON data across domains Used with jsonp callback jQuery.getScript(url, [callback]) Loads and executes scripts Useful for “delay-loading” scripts
  • 28. Ajax and jQuery jQuery.ajax(options) Gives you more control over your ajax calls Can monitor and ajax call using events ajaxStart ajaxSend, ajaxSuccess, ajaxError, ajaxComplete ajaxStop Can use jQuery.ajaxSetup(options) to specify options for jQuery.ajax once
  • 30. Effects Using jQuery and Plugins jQuery has built-in functions that allows you to hide/show/animate elements show() .hide() slideDown(speed, [callback]) slideUp(speed, [callback]) fadeIn(speed, [callback]), fadeOut(speed, [callback] ), fadeTo(speed, [callback]) animate allows you a fine-grained control over animations
  • 31. Effects Using jQuery and Plugins jQuery is extensible using a plugin model Hundreds of plugins exist Writing one yourself is easy too! Plugins can Enhance UIs (auto-complete, calendars, sort tables etc.) Provide custom animations (advanced sliding, fading) Provide utility functions (cookie handling, JSON handling)
  • 33. jQuery Utility Functions Browser detection jQuery.browser, jQuery.browser.version Iterator jQuery.each(object, callback) String handling jQuery.trim(str) Array handling jQuery.grep(array, callback, [invert]) jQuery.map(array, callback)
  • 34. jQuery and Microsoft jQuery now part of official ASP.NET stack Can download a ‘development’ version that adds intellisense to VS Ships with ASP.NET MVC Will possibly ship with future versions of Visual Studio
  • 35. Demo: jQuery and Visual Studio
  • 36. Summary Cross browser Javascript programming tedious jQuery makes it easy to write compact, reliable cross-browser code Robust support for AJAX 100s of 3rd party plugins Vibrant community
  • 37. Resources Online: Documentation: docs.jquery.com Blogs: learningjquery.com, ejohn.org deepakg.com/prog/ Offline Manning Press: jQuery In Action Manning Press: Secrets of Javascript Ninjas Packt Publishing: Learning jQuery Packt Publishing: jQuery Reference Guide

Notas do Editor

  1. [attribute] Returns: Array<Element(s)> Matches elements that have the specified attribute. Note the \"@\" before the attribute name was deprecated as of version 1.2. [attribute=value] Returns: Array<Element(s)> Matches elements that have the specified attribute with a certain value. [attribute!=value] Returns: Array<Element(s)> Matches elements that either don't have the specified attribute or do have the specified attribute but not with a certain value. [attribute^=value] Returns: Array<Element(s)> Matches elements that have the specified attribute and it starts with a certain value. [attribute$=value] Returns: Array<Element(s)> Matches elements that have the specified attribute and it ends with a certain value. [attribute*=value] Returns: Array<Element(s)> Matches elements that have the specified attribute and it contains a certain value. [attributeFilter1][attributeFilter2][attributeFilterN] Returns: Array<Element(s)> Matches elements that match all of the specified attribute filters.