SlideShare a Scribd company logo
About Myself
● Abdul Baquee Shaikh
● Demostrable knowledge in front-end/back-end tools (6.5 years).
● I am specializing in building web apps for social media
platforms
● My hobbies is learning new tools in front-end and back-end
development & I love to share knowledge
Github Links:
– https://github.com/abdulbaquee/
– http://www.socialscript.in/jqueryselectors/
Why jQuery ?
There are lots of other JavaScript frameworks out
there, but jQuery seems to be the most popular,
and also the most extendable.
Biggest companies on the Web use jQuery:
➢ Google
➢ Microsoft
➢ IBM
➢ Netflix
JavaScript VS jQuery
Jquery
$ (‘body’) .css (‘background’, ‘#ccc’);
JavaScript
Function changeBackground(color) {
Document.body.style.background = color;
}
Onload=”changeBackground (‘red’);”
jQuery
jQuery is a fast, small, cross-platform and feature-
rich JavaScript Library. It's greatly simplifies
JavaScript programming and it's easy to learn.
Features of jQuery
➢ HTML/DOM manipulation(Document Object Model)
➢ CSS manipulation
➢ HTML event methods
➢ Effects and animations
➢ AJAX
➢ Utilities (utility functions or functions that affect global
properties and behaviour)
Topics
1. Selectors
2. Events
3. Effects
4. Traversing
5. noConflict()
What You Should Already Know ?
➢ HTML
➢ CSS
➢ JavaScript
Jquery Selectors
What Is Jquery Selectors ?
A jQuery Selector is a function which makes
use of expressions to find out matching
elements from a DOM based on the given
criteria.
Once an element is selected then we can
perform various operations on that selected
element.
Lists of jQuery Selectors
➢ Basic Selectors
➢ Hierarchy Selectors
➢ Basic Filters
➢ Content Filters
➢ Visibility Filters
➢ Attribute Filters
➢ Child Filters
➢ Forms
➢ Form Filters
Basic Selectors
All Selector (“*”)
- Selects all elements.
Class Selector (“.class”)
- Selects all elements with the given class.
ID Selector (“#id”)
- Selects a single element with the given id attribute.
Multiple Selector (“selector1, selector2, selectorN”)
- Selects the combined results of all the specified selectors.
Hierarchy Selectors
Descendant Selector (“div code”)
- A selector to filter the descendant elements.
Child Selector (“parent > child”)
- A selector to filter the child elements.
Next Adjacent Selector (“prev + next”)
- A selector to match the element that is next to the first selector.
Next Siblings Selector (“prev ~ siblings”)
- A selector to filter elements that are the following siblings of the
first selector.
Basic Filters
:first Selector
- Selects the first matched DOM element.
:last Selector
- Selects the last matched element.
:not() Selector
- A selector with which to filter by.
:even Selector Or :odd Selector
- Selects even/odd elements, zero-indexed
:eq(n) Selector
- Zero-based index of the element to match.
:gt(n) Selector
- Select all elements at an index greater than index within the matched set.
:lt(n) Selector
- Select all elements at an index less than index within the matched set.
:header Selector
-> Selects all elements that are headers, like h1, h2, h3 and so on.
Content Filters
:contains() Selector
- Select all elements that contain the specified text.
:empty Selector
- Select all elements that have no children (including text nodes).
:has() Selector
- Selects elements which contain at least one element that
matches the specified selector.
:parent Selector
- Select all elements that have at least one child node (either an
element or text).
Visibility Filters
:hidden Selector
- Selects all elements that are hidden.
:visible Selector
- Selects all elements that are visible.
Attribute Filters
Has Attribute Selector [name]
- Selects elements that have the specified attribute, with any value.
Attribute Equals Selector [name=”value”]
- Selects elements that have the specified attribute with a value exactly equal to a certain value.
Attribute Not Equal Selector [name!=”value”]
- Select elements that either don't have the specified attribute, or do have the specified attribute but not with a
certain value.
Attribute Starts With Selector [name^=”value”]
- Selects elements that have the specified attribute with a value beginning exactly with a given string.
Attribute Ends With Selector [name$=”value”]
- Selects elements that have the specified attribute with a value ending exactly with a given string. The
comparison is case sensitive.
Attribute Contains Selector [name*=”value”]
- Selects elements that have the specified attribute with a value containing a given substring.
Multiple Attribute Selector [name=”value”][name2=”value2″]
- Matches elements that match all of the specified attribute filters.
Child Filters
:nth-child() Selector
- Selects all elements that are the nth-child of their parent.
:first-child Selector
- Selects all elements that are the first child of their parent.
:last-child Selector
- Selects all elements that are the last child of their parent.
:only-child Selector
- Selects all elements that are the only child of their parent.
Forms
:input Selector
- Selects all input, textarea, select and button elements.
:text Selector
- Selects all input elements of type text.
:password Selector
- Selects all elements of type password.
:radio Selector
- Selects all elements of type radio.
:checkbox Selector
- Selects all elements of type checkbox.
:submit Selector
- Selects all elements of type submit.
:image Selector
- Selects all elements of type image.
:reset Selector
- Selects all elements of type reset.
:button Selector
- Selects all button elements and elements of type button.
:file Selector
- Selects all elements of type file.
:hidden Selector
Selects all elements that are hidden.
Form Filters
:enabled Selector
- Selects all elements that are enabled.
:disabled Selector
- Selects all elements that are disabled.
:checked Selector
- Matches all elements that are checked or selected.
:selected Selector
- Selects all elements that are selected.
Jquery Events
Jquery Events
jQuery Events are used to register behaviors to take effect when the user
interacts with the browser, and to further manipulate those registered behaviors.
Lists of events by groups
● Browser Events
– .error(), .resize(), .scroll()
● Document Loading
– .load(), .ready(), .unload(),
●
Event Handler Attachment
– .bind(), .delegate(), .die(), jQuery.proxy(), .live(), .off(), .on(), .one(), .trigger(),
.triggerHandler(), .unbind(), .undelegate()
● Event Object
– Common Event Properties
● target,relatedTarget, pageX, pageY, which, metaKey
– Other Properties
● event.currentTarget, event.data, event.delegateTarget, event.isDefaultPrevented(),
event.isImmediatePropagationStopped(), event.isPropagationStopped(), event.metaKey,
event.namespace, event.pageX, event.pageY, event.preventDefault(), event.relatedTarget,
event.result, event.stopImmediatePropagation(), event.stopPropagation(), event.target,
event.timeStamp, event.type, event.which Continue...
● Form Event
– .blur(), .change(), .focus(), .focusin(), .focusout(),
.select(), .submit()
Continue...
jQuery Effects
Effects
The jQuery library provides several techniques for adding animation to a web page.
These include simple, standard animations that are frequently used, and the ability to craft
sophisticated custom effects.
Lists of Common Effects
.animate()
– Perform a custom animation of a set of CSS properties.
.clearQueue()
– Remove from the queue all items that have not yet been run.
.delay()
– Set a timer to delay execution of subsequent items in the queue.
.dequeue()
– Execute the next function on the queue for the matched elements.
.fadeIn()
– Display the matched elements by fading them to opaque.
.fadeOut()
– Hide the matched elements by fading them to transparent.
.fadeTo()
– Adjust the opacity of the matched elements.
.hide()
– Hide the matched elements.
jQuery Traversing
What is Traversing?
jQuery traversing, which means "move through",
are used to "find" (or select) HTML elements
based on their relation to other elements.
Start with one selection and move through that
selection until you reach the elements you
desire.
Traversing can be broken down into three basic
parts: parents, children, and siblings
The image above illustrates a family tree. With jQuery traversing,
you can easily move up (ancestors), down (descendants) and sideways (siblings)
in the family tree, starting from the selected (current) element.
This movement is called traversing - or moving through - the DOM.
Commonly used JQuery traversal Methods
➢ add
➢ Create a new jQuery object with elements added to the set of matched elements.
➢ children()
➢ Get the children of each element in the set of matched elements, optionally filtered by a
selector.
➢ closest()
➢ Returns the first ancestor of the selected element
➢ parent()
➢ Get the parent of each element in the current set of matched elements, optionally filtered by a
selector.
➢ siblings()
➢ Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
➢ each()
➢ Iterate over a jQuery object, executing a function for each matched element.
➢ first()
➢ Reduce the set of matched elements to the first in the set.
➢ last()
➢ Reduce the set of matched elements to the final one in the set.
➢ next()
➢ Get the immediately following sibling of each element in the set of matched elements. If a
selector is provided, it retrieves the next sibling only if it matches that selector.
➢ prev()
➢ Get the immediately preceding sibling of each element in the set of matched elements. If a
selector is provided, it retrieves the previous sibling only if it matches that selector.
jQuery - The noConflict() Method
jQuery and Other JavaScript Frameworks
As you already know; jQuery uses the $ sign as a shortcut for jQuery.
There are many other popular JavaScript frameworks like: Angular,
Backbone, Ember, Knockout, and more.
What if other JavaScript frameworks also use the $ sign as a
shortcut?
If two different frameworks are using the same shortcut, one of them
might stop working.
The jQuery team have already thought about this, and implemented
the noConflict() method.
The jQuery noConflict() Method
The noConflict() method releases the hold on the $ shortcut identifier,
so that other scripts can use it.
Examples
Example1:
$.noConflict();
jQuery(document).ready(function(){
jQuery("button").click(function(){
jQuery("p").text("jQuery is still working!");
});
});
Example2:
var jq = $.noConflict();
jq(document).ready(function(){
jq("button").click(function(){
jq("p").text("jQuery is still working!");
});
});
Example3:
$.noConflict();
jQuery(document).ready(function($){
$("button").click(function(){
$("p").text("jQuery is still working!");
});
});
Other Uses Of jQuery ?
➢ Server-side programming
➢ Game development
➢ Creating desktop applications
What is Next ???
1. Ajax Event Handlers
2. JavaScript MVC
3. Good part of JavaScript
4. JavaScript code organization best practices
Jquery for Beginners

More Related Content

PDF
jQuery BootCamp : Creating the Wrapped Element Set
PPT
jquery examples
PPT
J query introduction
PDF
jQuery 1.7 visual cheat sheet
PDF
Jquery 17-visual-cheat-sheet1
PPTX
JQuery
PPT
Jquery Example PPT
PPTX
J Query Introduction And JQuery Selectors
jQuery BootCamp : Creating the Wrapped Element Set
jquery examples
J query introduction
jQuery 1.7 visual cheat sheet
Jquery 17-visual-cheat-sheet1
JQuery
Jquery Example PPT
J Query Introduction And JQuery Selectors

What's hot (18)

PPT
J query lecture 1
PPTX
PPTX
jQuery Fundamentals
PPTX
Iniciando com jquery
PPTX
How to increase Performance of Web Application using JQuery
PPTX
PPTX
jQuery, CSS3 and ColdFusion
PPTX
Css Selectors
PPTX
A to Z about JQuery - Become Newbie to Expert Java Developer
PPTX
PPT
PDF
Web Design & Development - Session 6
PDF
J querypractice
PDF
Changeyrmarkup
PPT
Pierre Livet: Ontologies, from entities to operations.
PPT
JQuery introduction
J query lecture 1
jQuery Fundamentals
Iniciando com jquery
How to increase Performance of Web Application using JQuery
jQuery, CSS3 and ColdFusion
Css Selectors
A to Z about JQuery - Become Newbie to Expert Java Developer
Web Design & Development - Session 6
J querypractice
Changeyrmarkup
Pierre Livet: Ontologies, from entities to operations.
JQuery introduction
Ad

Viewers also liked (10)

PDF
Say It With Javascript
PPTX
Javascript & jquery
PPT
jQuery Learning
PPTX
Introduction to PHP
PPTX
Introduction to JavaScript Programming
PPTX
Introduction to jQuery
PDF
Java script aula 09 - JQuery
PDF
jQuery for beginners
PDF
Learning jQuery in 30 minutes
ODP
PHP Web Programming
Say It With Javascript
Javascript & jquery
jQuery Learning
Introduction to PHP
Introduction to JavaScript Programming
Introduction to jQuery
Java script aula 09 - JQuery
jQuery for beginners
Learning jQuery in 30 minutes
PHP Web Programming
Ad

Similar to Jquery for Beginners (20)

PDF
J query 17-visual-cheat-sheet1
PDF
J query 1.7 cheat sheet
PPTX
Getting Started with jQuery
PDF
VISUAL CHEAT SHEET
PPTX
Jquery Complete Presentation along with Javascript Basics
PPTX
Web technologies-course 11.pptx
ODP
Jquery- One slide completing all JQuery
PDF
Introduction to jQuery
PDF
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
PDF
J query 1.5-visual-cheat-sheet
PPTX
PPTX
jQuery basics for Beginners
PPTX
FFW Gabrovo PMG - jQuery
PPT
J query module1
PPTX
Introduction to JQuery
PPTX
PPTX
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
PPTX
Working With JQuery Part1
PPTX
J query 17-visual-cheat-sheet1
J query 1.7 cheat sheet
Getting Started with jQuery
VISUAL CHEAT SHEET
Jquery Complete Presentation along with Javascript Basics
Web technologies-course 11.pptx
Jquery- One slide completing all JQuery
Introduction to jQuery
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
J query 1.5-visual-cheat-sheet
jQuery basics for Beginners
FFW Gabrovo PMG - jQuery
J query module1
Introduction to JQuery
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
Working With JQuery Part1

More from Mohd Abdul Baquee (7)

PPTX
Cursor - AI Code Editor: Revolutionizing Coding with AI-Powered Tools
PPTX
Mastering REST APIs: A Comprehensive Guide to Building and Using REST Clients
PPTX
Angularjs - custom directives part 05
PPTX
Angularjs rounting part 04
PPTX
Angularjs Services part 03
PPTX
Angularjs scope part 02
PPTX
Angularjs basic part01
Cursor - AI Code Editor: Revolutionizing Coding with AI-Powered Tools
Mastering REST APIs: A Comprehensive Guide to Building and Using REST Clients
Angularjs - custom directives part 05
Angularjs rounting part 04
Angularjs Services part 03
Angularjs scope part 02
Angularjs basic part01

Recently uploaded (20)

PDF
Insiders guide to clinical Medicine.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Anesthesia in Laparoscopic Surgery in India
Insiders guide to clinical Medicine.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
VCE English Exam - Section C Student Revision Booklet
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Sports Quiz easy sports quiz sports quiz
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Renaissance Architecture: A Journey from Faith to Humanism
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPH.pptx obstetrics and gynecology in nursing
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Final Presentation General Medicine 03-08-2024.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Computing-Curriculum for Schools in Ghana
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Abdominal Access Techniques with Prof. Dr. R K Mishra
O7-L3 Supply Chain Operations - ICLT Program
Anesthesia in Laparoscopic Surgery in India

Jquery for Beginners

  • 1. About Myself ● Abdul Baquee Shaikh ● Demostrable knowledge in front-end/back-end tools (6.5 years). ● I am specializing in building web apps for social media platforms ● My hobbies is learning new tools in front-end and back-end development & I love to share knowledge Github Links: – https://github.com/abdulbaquee/ – http://www.socialscript.in/jqueryselectors/
  • 2. Why jQuery ? There are lots of other JavaScript frameworks out there, but jQuery seems to be the most popular, and also the most extendable. Biggest companies on the Web use jQuery: ➢ Google ➢ Microsoft ➢ IBM ➢ Netflix
  • 3. JavaScript VS jQuery Jquery $ (‘body’) .css (‘background’, ‘#ccc’); JavaScript Function changeBackground(color) { Document.body.style.background = color; } Onload=”changeBackground (‘red’);”
  • 4. jQuery jQuery is a fast, small, cross-platform and feature- rich JavaScript Library. It's greatly simplifies JavaScript programming and it's easy to learn.
  • 5. Features of jQuery ➢ HTML/DOM manipulation(Document Object Model) ➢ CSS manipulation ➢ HTML event methods ➢ Effects and animations ➢ AJAX ➢ Utilities (utility functions or functions that affect global properties and behaviour)
  • 6. Topics 1. Selectors 2. Events 3. Effects 4. Traversing 5. noConflict()
  • 7. What You Should Already Know ? ➢ HTML ➢ CSS ➢ JavaScript
  • 9. What Is Jquery Selectors ? A jQuery Selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria. Once an element is selected then we can perform various operations on that selected element.
  • 10. Lists of jQuery Selectors ➢ Basic Selectors ➢ Hierarchy Selectors ➢ Basic Filters ➢ Content Filters ➢ Visibility Filters ➢ Attribute Filters ➢ Child Filters ➢ Forms ➢ Form Filters
  • 11. Basic Selectors All Selector (“*”) - Selects all elements. Class Selector (“.class”) - Selects all elements with the given class. ID Selector (“#id”) - Selects a single element with the given id attribute. Multiple Selector (“selector1, selector2, selectorN”) - Selects the combined results of all the specified selectors.
  • 12. Hierarchy Selectors Descendant Selector (“div code”) - A selector to filter the descendant elements. Child Selector (“parent > child”) - A selector to filter the child elements. Next Adjacent Selector (“prev + next”) - A selector to match the element that is next to the first selector. Next Siblings Selector (“prev ~ siblings”) - A selector to filter elements that are the following siblings of the first selector.
  • 13. Basic Filters :first Selector - Selects the first matched DOM element. :last Selector - Selects the last matched element. :not() Selector - A selector with which to filter by. :even Selector Or :odd Selector - Selects even/odd elements, zero-indexed :eq(n) Selector - Zero-based index of the element to match. :gt(n) Selector - Select all elements at an index greater than index within the matched set. :lt(n) Selector - Select all elements at an index less than index within the matched set. :header Selector -> Selects all elements that are headers, like h1, h2, h3 and so on.
  • 14. Content Filters :contains() Selector - Select all elements that contain the specified text. :empty Selector - Select all elements that have no children (including text nodes). :has() Selector - Selects elements which contain at least one element that matches the specified selector. :parent Selector - Select all elements that have at least one child node (either an element or text).
  • 15. Visibility Filters :hidden Selector - Selects all elements that are hidden. :visible Selector - Selects all elements that are visible.
  • 16. Attribute Filters Has Attribute Selector [name] - Selects elements that have the specified attribute, with any value. Attribute Equals Selector [name=”value”] - Selects elements that have the specified attribute with a value exactly equal to a certain value. Attribute Not Equal Selector [name!=”value”] - Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value. Attribute Starts With Selector [name^=”value”] - Selects elements that have the specified attribute with a value beginning exactly with a given string. Attribute Ends With Selector [name$=”value”] - Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive. Attribute Contains Selector [name*=”value”] - Selects elements that have the specified attribute with a value containing a given substring. Multiple Attribute Selector [name=”value”][name2=”value2″] - Matches elements that match all of the specified attribute filters.
  • 17. Child Filters :nth-child() Selector - Selects all elements that are the nth-child of their parent. :first-child Selector - Selects all elements that are the first child of their parent. :last-child Selector - Selects all elements that are the last child of their parent. :only-child Selector - Selects all elements that are the only child of their parent.
  • 18. Forms :input Selector - Selects all input, textarea, select and button elements. :text Selector - Selects all input elements of type text. :password Selector - Selects all elements of type password. :radio Selector - Selects all elements of type radio. :checkbox Selector - Selects all elements of type checkbox. :submit Selector - Selects all elements of type submit. :image Selector - Selects all elements of type image. :reset Selector - Selects all elements of type reset. :button Selector - Selects all button elements and elements of type button. :file Selector - Selects all elements of type file. :hidden Selector Selects all elements that are hidden.
  • 19. Form Filters :enabled Selector - Selects all elements that are enabled. :disabled Selector - Selects all elements that are disabled. :checked Selector - Matches all elements that are checked or selected. :selected Selector - Selects all elements that are selected.
  • 21. Jquery Events jQuery Events are used to register behaviors to take effect when the user interacts with the browser, and to further manipulate those registered behaviors. Lists of events by groups ● Browser Events – .error(), .resize(), .scroll() ● Document Loading – .load(), .ready(), .unload(), ● Event Handler Attachment – .bind(), .delegate(), .die(), jQuery.proxy(), .live(), .off(), .on(), .one(), .trigger(), .triggerHandler(), .unbind(), .undelegate() ● Event Object – Common Event Properties ● target,relatedTarget, pageX, pageY, which, metaKey – Other Properties ● event.currentTarget, event.data, event.delegateTarget, event.isDefaultPrevented(), event.isImmediatePropagationStopped(), event.isPropagationStopped(), event.metaKey, event.namespace, event.pageX, event.pageY, event.preventDefault(), event.relatedTarget, event.result, event.stopImmediatePropagation(), event.stopPropagation(), event.target, event.timeStamp, event.type, event.which Continue...
  • 22. ● Form Event – .blur(), .change(), .focus(), .focusin(), .focusout(), .select(), .submit() Continue...
  • 24. Effects The jQuery library provides several techniques for adding animation to a web page. These include simple, standard animations that are frequently used, and the ability to craft sophisticated custom effects. Lists of Common Effects .animate() – Perform a custom animation of a set of CSS properties. .clearQueue() – Remove from the queue all items that have not yet been run. .delay() – Set a timer to delay execution of subsequent items in the queue. .dequeue() – Execute the next function on the queue for the matched elements. .fadeIn() – Display the matched elements by fading them to opaque. .fadeOut() – Hide the matched elements by fading them to transparent. .fadeTo() – Adjust the opacity of the matched elements. .hide() – Hide the matched elements.
  • 26. What is Traversing? jQuery traversing, which means "move through", are used to "find" (or select) HTML elements based on their relation to other elements. Start with one selection and move through that selection until you reach the elements you desire. Traversing can be broken down into three basic parts: parents, children, and siblings
  • 27. The image above illustrates a family tree. With jQuery traversing, you can easily move up (ancestors), down (descendants) and sideways (siblings) in the family tree, starting from the selected (current) element. This movement is called traversing - or moving through - the DOM.
  • 28. Commonly used JQuery traversal Methods ➢ add ➢ Create a new jQuery object with elements added to the set of matched elements. ➢ children() ➢ Get the children of each element in the set of matched elements, optionally filtered by a selector. ➢ closest() ➢ Returns the first ancestor of the selected element ➢ parent() ➢ Get the parent of each element in the current set of matched elements, optionally filtered by a selector. ➢ siblings() ➢ Get the siblings of each element in the set of matched elements, optionally filtered by a selector. ➢ each() ➢ Iterate over a jQuery object, executing a function for each matched element. ➢ first() ➢ Reduce the set of matched elements to the first in the set. ➢ last() ➢ Reduce the set of matched elements to the final one in the set. ➢ next() ➢ Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. ➢ prev() ➢ Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.
  • 29. jQuery - The noConflict() Method jQuery and Other JavaScript Frameworks As you already know; jQuery uses the $ sign as a shortcut for jQuery. There are many other popular JavaScript frameworks like: Angular, Backbone, Ember, Knockout, and more. What if other JavaScript frameworks also use the $ sign as a shortcut? If two different frameworks are using the same shortcut, one of them might stop working. The jQuery team have already thought about this, and implemented the noConflict() method. The jQuery noConflict() Method The noConflict() method releases the hold on the $ shortcut identifier, so that other scripts can use it.
  • 30. Examples Example1: $.noConflict(); jQuery(document).ready(function(){ jQuery("button").click(function(){ jQuery("p").text("jQuery is still working!"); }); }); Example2: var jq = $.noConflict(); jq(document).ready(function(){ jq("button").click(function(){ jq("p").text("jQuery is still working!"); }); }); Example3: $.noConflict(); jQuery(document).ready(function($){ $("button").click(function(){ $("p").text("jQuery is still working!"); }); });
  • 31. Other Uses Of jQuery ? ➢ Server-side programming ➢ Game development ➢ Creating desktop applications
  • 32. What is Next ??? 1. Ajax Event Handlers 2. JavaScript MVC 3. Good part of JavaScript 4. JavaScript code organization best practices