際際滷

際際滷Share a Scribd company logo
Advanced JQuery Selectors
Advanced JQuery Selectors
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
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
03



$('[attribute!="value"]')

Description: Select elements that either don't have the specified attribute, or
do have the specified attribute but not with a certain value.

Example
04



$(':visible')

Description: Selects all elements that are visible.

Example


$(':checked')

Description: Matches all elements that are checked.

Example
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
06



$(':even')

Description: Selects even elements, zero-indexed.

Example


$(':odd')

Description: Selects odd elements, zero-indexed. See also even.

Example
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
08



$(':first')

Description: Selects the first matched element..

Example


$(':last')

Description: Selects the lastmatched element..

Example
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
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
11



$(':parent')

Description: Select all elements that are the parent of another element, including
text nodes.

Example
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
13



JQuery selectors documentation
All JQuery selectors and examples can be found on this link.


http://api.jquery.com/category/selectors/



Thank You. :)

More Related Content

Advanced JQuery Selectors