The jQuery factory function $()
is used to find elements on the page to work with. This function takes a string composed of CSS-like syntax, called a selector expression. Selector expressions are discussed in detail in Chapter 2, Selecting Elements.
Matches | |
---|---|
All elements | |
The element with the given ID | |
All elements of the given type | |
All elements with the given class | |
Elements that are matched by | |
Elements | |
Elements | |
Elements | |
Elements |
Matches | |
---|---|
|
Elements which are the |
|
Elements which are an even child of their parent element (1-based) |
|
Elements which are an odd child of their parent element (1-based) |
|
Elements which are the |
|
Elements which are the first child of their parent |
|
Elements which are the last child of their parent |
|
Elements which are the only child of their parent |
Matches | |
---|---|
|
The first element in the result set |
|
The last element in the result set |
|
All elements in the result set that are not matched by |
|
Even elements in the result set (0-based) |
|
Odd elements in the result set (0-based) |
|
A numbered element in the result set (0-based) |
|
All elements in the result set after (greater than) the given index (0-based) |
All elements in the result set before (less than) the given index (0-based) |
Matches | |
---|---|
|
Elements that have the attribute |
|
Elements whose |
|
Elements whose |
|
Elements whose |
|
Elements whose |
|
Elements whose |
|
Elements whose |
|
Elements whose |
Matches | |
---|---|
All | |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
Enabled form elements | |
Disabled form elements | |
Checked checkboxes and radio buttons | |
Selected |
Matches | |
---|---|
Header elements (e.g. | |
Elements with an animation in progress | |
Elements containing the given text | |
Elements with no child nodes | |
Elements containing a descendant element matching | |
Elements that have child nodes | |
Elements that are hidden, either through CSS or because they are | |
The inverse of | |
The element that has the keyboard focus |