jQuery TraversingLesson 21Free preview
jQuery Traversing
This lesson is part of jQuery · All levels
Summary
Traversing is a technique of moving from one element to another element in a DOM tree structure, for example to a parent, descendant, or sibling. jQuery provides special methods such as parent(), children(), and next() so you don't need to write manual repetitions. With traversing, the selection can be expanded or narrowed from the element you're holding.
Key points
- Traversing means tracing the relationships between elements within a DOM.
- Main relationships: parent, descendant, and sibling
- The traversing method returns the jQuery object so that it can be chained
- The initial selection can be expanded as to parents() or narrowed as to first()
- Traversing saves long and fragile selector writing
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.