Selector |
Match |
* |
All elements |
#id |
Element with given ID |
element |
All elements of a given type, say html tags |
.class |
All elements with a given class |
a,b |
Elements that match a or match b |
a b |
Elements matching b that are descendants of a (including grandchildren) |
a > b |
Elements that match b as a child element of a (only including children) |
:first |
The first element in the result set |
:last |
The last element in the result set |
:not(a) |
All elements in the result set that do not match a |
:even |
Even elements in the result set (counting from 0) |
:odd |
Odd elements in the result set (counting from 0) |
:eq(index) |
The element with index index in the result set (counting from 0) |
:gt(index) |
All elements in the result set after the given index (counting from 0) |
:lt(index) |
All elements in the result set before the given index (counting from 0) |
:header |
Heading element (
|
:animated |
The element whose animation is playing |
:contains(text) |
An element containing the given text text |
:empty |
Elements that do not contain child nodes |
:has(a) |
At least one of the descendant elements matches a |
:parent |
The direct parent element of the current element |
:hidden |
Hidden elements, including hiding through css and |
:visible |
Opposite of the element matched by :hidden |
[attr] |
Element with attribute attr |
[attr=value] |
Elements whose attr attribute is value |
[attr!=value] |
Elements whose attr attribute is not value |
[attr^=value] |
Elements whose attr attribute value starts with value |
[attr$=value] |
Elements whose attr attribute value ends with value |
[attr*=value] |
The value of the attr attribute contains the string value |
:nth-child(index) |
Matches the index child element of each element in the collection (counting from 1) |
:nth-child(even) |
Matches the even-numbered child elements of each element in the set (counting from 1)
|
:nth-child(odd) |
Matches the odd-numbered child elements of each element in the set (counting from 1)
|
:nth-child(formula) |
Formula is a formula, the format is an b, a and b are integers |
:first-child |
Matches the first child element of each element in the collection
|
:last-child |
Matches the last child element of each element in the set
|
:only-child |
Matches the unique sub-element of each element in the collection. If it is not unique, it will not be executed
|
:input |
All |
:text |
element of Type="text" |
:password |
element of Type="password" |
:radio |
element with Type="radio" |
:checkbox |
element of Type="checkbox" |
:submit |
element of Type="submit" |
:image |
element of Type="image" |
:reset |
element with Type="reset" |
:button |
elements and |
:file |
element of Type="file" |
:enabled |
Enabled form elements |
:disabled |
Disabled form elements |
:checked |
Selected checkbox and radio button elements |
:selected |
Selected |
Traversal method |
The jQuery object that returns the value contains |
.filter(selector) |
The selected element matching the given selector |
.filter(callback) |
The callback function callback returns true for the selected element |
.eq(index) |
The index-th selected element counting from 0 |
.slice(start,[end]) |
The selected elements of the given range counting from 0 |
.not(selector) |