|
Chapter 3:
DOM Traversal Methods
Cause there's a train coming into the station
But it's heading for a new destination
—Devo,
"It Doesn't Matter to Me"
In addition to the selector expressions described in Chapter 2, jQuery has a variety of DOM traversal methods to help us select elements in a document. These methods offer a great deal of flexibility, even allowing us to act upon multiple sets of elements in a single chain, like so:
$('div.section > p').addClass('lit').lt(1).addClass('profound');
At times the choice between a selector expression and a corresponding DOM traversal method is simply a matter of taste, but there is no doubt that the combined set of expressions and methods makes for an extremely powerful toolset for getting anything we want.
|
Chapter
3: DOM Traversal Methods
-
The jQuery Factory Function
-
$()
-
Filtering Methods
- .filter()
- .not()
- .contains()
- .eq()
- .lt()
- .gt()
-
Tree Traversal Methods
- .find()
- .children()
- .parents()
- .parent()
- .siblings()
- .prev()
- .next()
-
Miscellaneous Traversal Methods
|
|
Paperback 225 pages
Released: July 2007
ISBN: 1847193811
ISBN 13:
978-1-847193-81-0 |
|
|
|
|