Selector expressions
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.
Simple CSS
Selector | 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 |
Position among siblings
Selector | Matches |
| Elements that are the |
| Elements that are an even child of their parent element (1-based). |
| Elements that are an odd child of their parent element (1-based). |
| Elements that are the nth child of their parent element (1-based... |