This document provides descriptions and examples of various jQuery selectors. It covers attribute selectors that select elements based on attributes or attribute values. It also covers pseudo-class selectors that select elements based on conditions like visibility, position in the DOM, or whether they are checked/selected. Selectors are provided to select elements by index, child relationships, or by excluding certain elements. Links are included for further documentation.
1 of 15
More Related Content
Advanced JQuery Selectors
3. 01
$('[attribute|="value"]')
Description: Selects elements that have the specified attribute with a value
either equal to a given string or starting with that string followed by a hyphen
(-).
Example
$('[attribute*="value"]')
Description: Selects elements that have the specified attribute with a value
containing the a given substring.
Example
4. 02
$('[attribute^="value"]')
Description: Selects elements that have the specified attribute with a value
beginning exactly with a given string.
Example
$('[attribute$="value"]')
Description: Selects elements that have the specified attribute with a value
ending exactly with a given string. The comparison is case sensitive.
Example
7. 05
$(':eq(index)')
Description: Select the element at index n within the matched set.
Example
$(':nth-child(index/even/odd/equation)')
Description: Selects all elements that are the nth-child of their parent.
Example
9. 07
$(':first-child')
Description: Selects all elements that are the first child of their parent.
Example
$(':last-child')
Description: Selects all elements that are the last child of their parent.
Example
11. 09
$(':gt(index)')
Description: Select all elements at an index greater than index within the
matched set.
Example
$(':lt(index)')
Description: Select all elements at an index less than index within the
matched set.
Example
12. 10
$(':not(selector)')
Description: Selects all elements that do not match the given selector.
Example
$(':has(selector)')
Description: Selects elements which contain at least one element that matches
the specified selector.
Example
14. 12
$(':header')
Description: Selects all elements that are headers, like h1, h2, h3 and so on.
Example
Next Adjacent Selector (prev + next)
Description: Selects elements which contain at least one element that matches
the specified selector.
Example
15. 13
JQuery selectors documentation
All JQuery selectors and examples can be found on this link.
http://api.jquery.com/category/selectors/
Thank You. :)