SlideShare una empresa de Scribd logo
1 de 21
Introduction to JQuery Muhammad Afzal Microsoft Certified Technology Specialist
Introducing the jQuery Library jQuery is simply a file of JavaScript code that allows you to more easily write JavaScript code that runs in many different browsers. This code can do many things; it can work with UI styles,handleuser events, animate parts of your page, call back to the server via AJAX, and more. It is all about selecting the DOM elements , traversing through them and manipulating them. jQueryis one of the most popular and widely used framework. Even Microsoft has also contributed towards it.
Selecting DOM elements
Selection of DOM elements Select by element Finds all elements with a specified tag name and returns an array of those elements. You simply pass the name of the tag to the selector function, as in $("h2"). Select by ID Allows you to select a single element by its ID. You use the pound (#) character to indicate that you are searching by ID. For example, the element, <span id="someId"> can be searched for by using the function call $("#someId"). Select by cascading style sheet Allows you to find all tags with a specific cascading style sheet class name. You use a period (.) to indicate the class name. For example, to find all elements with the cascading style sheet class name of userInputStyle (as in <div class="userInputStyle">), you would use the $(".userInputStyle") selector.
Writing your first jQuery Demo1
jQuery Selector Examples $("h2:first") Used to find the first instance of the <h2> element. Similar syntax can be used for last, odd, and even. $("div:first-child") Used to select the all first child elements inside <div> tags on the page. Similar syntax can be used with last-child. $("#div1:nth-child(4)") Used to select the fourth child element inside the tag whose ID is div1. $("span:not(.sectionHead)") Used to select all <span/> tags that do not have the sectionHeadcascading style sheet class. $(":enabled") Returns all enabled elements on the page. The same syntax can also be used for disabled. $(":checked") Returns all checkbox elements on the page that are checked. Similar syntax can be used for selected items in a list. $("div:hidden") Returns all hidden <div/> tags on the page. Similar syntax can be used for visible. $(":contains(.docx)") Used to find all elements on the page that contain the text .docx. $("#div1 #div2") Finds any <div/> tags with the ID of div2 nested inside another <div/> tag with the ID of div1. $(":button") Used to find all elements of type button. You can use similar syntax with input, text, password, radio, submit, checkbox and image.
Traversing DOM elements
Traversing of DOM elements The result returned by a jQuery selector is a set of elements that match the selection criteria. Even if you only get a single element back in your selection, jQuery gives you a set of elements. This allows you to work with a single item or a collection of items by using the same syntax. Eg: $("h2").each(function (index) { ...
Traversing and manipulation of DOM elements Demo2
jQuery Traversing Examples $("span").get(0) $("span")[0] The .get() function allows you to select a single item inside a result set. Both lines of code search the DOM for all <span/> tags and return the first item inside the set of found items. var items = $("h2").size(); The .size function allows you to determine the number of elements in the result set. This code returns the number of found items and sets the value to a variable. $("h2").add("span").css("color", "green"); The .add() function allows you to add things to found items. This code finds all <h2/> elements and adds a <span/> tag with the cascading style sheet colorstyle set to green. You can use the .add() function to add selected elements, HTML fragments, another element, and more. $("h2").eq(1).css("color", "green"); The .eq() function allows you to cut down the size of your result set to a single item from the returned set. This code selects the second <h2/> item and turns it green. (Note that the index is zero based.)
Handling Client side Events
Client side Events The jQuery language allows you to bind scripts to client-side events such as button clicks,mousemovement, and keyboard interaction. These are the simple event handler registration methods jQuerydefines following events blur() focusin() mousedown() mouseup() change() focusout() mouseenter() resize() click() keydown() mouseleave() scroll() dblclick() keypress() mousemove() select() error() keyup() mouseout() submit() focus() load() mouseover() unload() To event registration syntax is simple $(“#elementname”).bind(“eventname”,”eventhandlder”) The unbind method can be used for deregistration of events.
Events handling Demo3
Animations
Effects and Animations The jQuery library provides methods for adding client-side effects to your elements such as show, hide, fade in, and more.  These effects and animations are easy to use. You simply find your elements by using a jQuery search and then call the effect you want.  You can also combine effects in a queue-like manner through method chaining.  This is as simple as adding one method call after another, as in the following fadeIn().fadeOut().fadeIn()
Animation effects Demo4
Implementing Ajax with jQuery
Implementing Ajax The jQuery.ajax() method enables you to call a web service and then update your page with the results.  This method performs an asynchronous HTTP request, passes data to the request, and gets the results. You can use this method for a variety of tasks, including loading and executing a .js file, posting data to a web form, getting the HTML of a page, and sending and receiving XML data. This method takes several name-value pairs as a parameter, called settings. The settings include the URL of your request, the content-type, the HTTP method (GET or POST), and the user name and password of the request. In fact, there are more than 20 settings with which you can work.
Calling Webservice via jQuery Demo5
Resources jQuery official websitehttp://jquery.com My Bloghttp://goldytech.wordpress.com
Questions?

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

JQuery
JQueryJQuery
JQuery
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Javascript Experiment
Javascript ExperimentJavascript Experiment
Javascript Experiment
 
jQuery basics for Beginners
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for Beginners
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
JavaScript
JavaScriptJavaScript
JavaScript
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
jQuery
jQueryjQuery
jQuery
 
J query training
J query trainingJ query training
J query training
 
Testando API's de forma unitária mocando as dependências
Testando API's de forma unitária mocando as dependênciasTestando API's de forma unitária mocando as dependências
Testando API's de forma unitária mocando as dependências
 
Slashdot Tags
Slashdot TagsSlashdot Tags
Slashdot Tags
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery
jQueryjQuery
jQuery
 
Learn css3
Learn css3Learn css3
Learn css3
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 

Destacado

高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム
高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム
高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステムplatinumhandbook
 
jQuery Tips'n'Tricks
jQuery Tips'n'TricksjQuery Tips'n'Tricks
jQuery Tips'n'TricksNikola Plejic
 
140520 shareability gruppe3
140520 shareability gruppe3140520 shareability gruppe3
140520 shareability gruppe3How Mightwe
 

Destacado (7)

Miigaaaaa
MiigaaaaaMiigaaaaa
Miigaaaaa
 
高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム
高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム
高齢者に優しい自動車開発プロジェクト、福岡発 紙おむつリサイクルシステム
 
Report on Social networking - 2E
Report on Social networking - 2EReport on Social networking - 2E
Report on Social networking - 2E
 
jQuery Tips'n'Tricks
jQuery Tips'n'TricksjQuery Tips'n'Tricks
jQuery Tips'n'Tricks
 
kraken
krakenkraken
kraken
 
Cannabis linköping 2010 12-09, ulf guttormsson
Cannabis  linköping 2010 12-09, ulf guttormssonCannabis  linköping 2010 12-09, ulf guttormsson
Cannabis linköping 2010 12-09, ulf guttormsson
 
140520 shareability gruppe3
140520 shareability gruppe3140520 shareability gruppe3
140520 shareability gruppe3
 

Similar a Introduction to JQuery

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 BasicsEPAM Systems
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxAditiPawale1
 
presentation_jquery_ppt.pptx
presentation_jquery_ppt.pptxpresentation_jquery_ppt.pptx
presentation_jquery_ppt.pptxazz71
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryGunjan Kumar
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfUnit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfRAVALCHIRAG1
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQueryLaila Buncab
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSRSolutions
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And TricksLester Lievens
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginnersIsfand yar Khan
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperManoj Bhuva
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 

Similar a Introduction to JQuery (20)

jQuery
jQueryjQuery
jQuery
 
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_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptx
 
Jquery
JqueryJquery
Jquery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
jQuery
jQueryjQuery
jQuery
 
J query
J queryJ query
J query
 
presentation_jquery_ppt.pptx
presentation_jquery_ppt.pptxpresentation_jquery_ppt.pptx
presentation_jquery_ppt.pptx
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfUnit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONS
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And Tricks
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginners
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java Developer
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Jquery
JqueryJquery
Jquery
 
Jquery
JqueryJquery
Jquery
 

Último

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Último (20)

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Introduction to JQuery

  • 1. Introduction to JQuery Muhammad Afzal Microsoft Certified Technology Specialist
  • 2. Introducing the jQuery Library jQuery is simply a file of JavaScript code that allows you to more easily write JavaScript code that runs in many different browsers. This code can do many things; it can work with UI styles,handleuser events, animate parts of your page, call back to the server via AJAX, and more. It is all about selecting the DOM elements , traversing through them and manipulating them. jQueryis one of the most popular and widely used framework. Even Microsoft has also contributed towards it.
  • 4. Selection of DOM elements Select by element Finds all elements with a specified tag name and returns an array of those elements. You simply pass the name of the tag to the selector function, as in $("h2"). Select by ID Allows you to select a single element by its ID. You use the pound (#) character to indicate that you are searching by ID. For example, the element, <span id="someId"> can be searched for by using the function call $("#someId"). Select by cascading style sheet Allows you to find all tags with a specific cascading style sheet class name. You use a period (.) to indicate the class name. For example, to find all elements with the cascading style sheet class name of userInputStyle (as in <div class="userInputStyle">), you would use the $(".userInputStyle") selector.
  • 5. Writing your first jQuery Demo1
  • 6. jQuery Selector Examples $("h2:first") Used to find the first instance of the <h2> element. Similar syntax can be used for last, odd, and even. $("div:first-child") Used to select the all first child elements inside <div> tags on the page. Similar syntax can be used with last-child. $("#div1:nth-child(4)") Used to select the fourth child element inside the tag whose ID is div1. $("span:not(.sectionHead)") Used to select all <span/> tags that do not have the sectionHeadcascading style sheet class. $(":enabled") Returns all enabled elements on the page. The same syntax can also be used for disabled. $(":checked") Returns all checkbox elements on the page that are checked. Similar syntax can be used for selected items in a list. $("div:hidden") Returns all hidden <div/> tags on the page. Similar syntax can be used for visible. $(":contains(.docx)") Used to find all elements on the page that contain the text .docx. $("#div1 #div2") Finds any <div/> tags with the ID of div2 nested inside another <div/> tag with the ID of div1. $(":button") Used to find all elements of type button. You can use similar syntax with input, text, password, radio, submit, checkbox and image.
  • 8. Traversing of DOM elements The result returned by a jQuery selector is a set of elements that match the selection criteria. Even if you only get a single element back in your selection, jQuery gives you a set of elements. This allows you to work with a single item or a collection of items by using the same syntax. Eg: $("h2").each(function (index) { ...
  • 9. Traversing and manipulation of DOM elements Demo2
  • 10. jQuery Traversing Examples $("span").get(0) $("span")[0] The .get() function allows you to select a single item inside a result set. Both lines of code search the DOM for all <span/> tags and return the first item inside the set of found items. var items = $("h2").size(); The .size function allows you to determine the number of elements in the result set. This code returns the number of found items and sets the value to a variable. $("h2").add("span").css("color", "green"); The .add() function allows you to add things to found items. This code finds all <h2/> elements and adds a <span/> tag with the cascading style sheet colorstyle set to green. You can use the .add() function to add selected elements, HTML fragments, another element, and more. $("h2").eq(1).css("color", "green"); The .eq() function allows you to cut down the size of your result set to a single item from the returned set. This code selects the second <h2/> item and turns it green. (Note that the index is zero based.)
  • 12. Client side Events The jQuery language allows you to bind scripts to client-side events such as button clicks,mousemovement, and keyboard interaction. These are the simple event handler registration methods jQuerydefines following events blur() focusin() mousedown() mouseup() change() focusout() mouseenter() resize() click() keydown() mouseleave() scroll() dblclick() keypress() mousemove() select() error() keyup() mouseout() submit() focus() load() mouseover() unload() To event registration syntax is simple $(“#elementname”).bind(“eventname”,”eventhandlder”) The unbind method can be used for deregistration of events.
  • 15. Effects and Animations The jQuery library provides methods for adding client-side effects to your elements such as show, hide, fade in, and more. These effects and animations are easy to use. You simply find your elements by using a jQuery search and then call the effect you want. You can also combine effects in a queue-like manner through method chaining. This is as simple as adding one method call after another, as in the following fadeIn().fadeOut().fadeIn()
  • 18. Implementing Ajax The jQuery.ajax() method enables you to call a web service and then update your page with the results. This method performs an asynchronous HTTP request, passes data to the request, and gets the results. You can use this method for a variety of tasks, including loading and executing a .js file, posting data to a web form, getting the HTML of a page, and sending and receiving XML data. This method takes several name-value pairs as a parameter, called settings. The settings include the URL of your request, the content-type, the HTTP method (GET or POST), and the user name and password of the request. In fact, there are more than 20 settings with which you can work.
  • 19. Calling Webservice via jQuery Demo5
  • 20. Resources jQuery official websitehttp://jquery.com My Bloghttp://goldytech.wordpress.com

Notas del editor

  1. This template can be used as a starter file for presenting training materials in a group setting.SectionsRight-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors.NotesUse the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production)Coordinated colors Pay particular attention to the graphs, charts, and text boxes.Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale.Graphics, tables, and graphsKeep it simple: If possible, use consistent, non-distracting styles and colors.Label all graphs and tables.
  2. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  3. This is another option for an Overview slides using transitions.
  4. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  5. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  6. This is another option for an Overview slides using transitions.
  7. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  8. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  9. This is another option for an Overview slides using transitions.
  10. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  11. This is another option for an Overview slides using transitions.
  12. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  13. This is another option for an Overview slides using transitions.
  14. Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.