DOM traversal methods
After creating a jQuery object using $()
, we can alter the set of matched elements we are working with by calling one of these DOM traversal methods. DOM traversal methods are discussed in detail in Chapter 2, Selecting Elements.
Filtering
Traversal method | Returns a jQuery object containing... |
| Selected elements that match the given selector. |
| Selected elements for which the callback function returns |
| The selected element at the given 0-based index. |
| The first selected element. |
| The final selected element. |
| Selected elements in the given range of 0-based indices. |
| Selected elements that do not match the given selector. |
| Selected elements that have a descendant matching |
Descendants
Traversal method | Returns a jQuery object containing... |
| Descendant elements that match the selector. |
| Child nodes (including text nodes). |
| Child nodes... |