jQuery 1.4 Reference Guide
上QQ阅读APP看书,第一时间看更新

Chapter 3. DOM Traversal Methods

In addition to the selector expressions described in Chapter 2, Selector Expressions, jQuery has a variety of DOM traversal methods that 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 as follows:

$('div.section').addClass('lit').eq(1).addClass('profound');

At times, the choice between a selector expression and a corresponding DOM traversal method is simply a matter of taste. However, there is no doubt that the combined set of expressions and methods makes for an extremely powerful toolset for acting on any part of the document we desire.