Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Web Browser
Traversing the DOM

Review: Traversing the DOM

Understanding how elements relate to each other in the DOM makes it easy to efficiently select elements. We have covered several methods in this lesson including:

  • .children() to target an element's child elements.
  • .siblings() to target elements adjacent to an element.
  • .parent() to target an element's parent.
  • .closest() travels up the DOM tree from the current element to target the closest element with a given selector.
  • .next() to target the element immediately following the selected element.
  • .prev() to target the element that is immediately preceding the selected element.
  • .find() to target descendant elements by some selector, ie- class, id, tag etc.

In addition to these methods, there are even more, including .prevUntil(), .nextUntil() and others. To get an idea, check out Mozilla Developer Network reference for jQuery Traversing.

Report a Bug
If you see a bug or any other issue with this page, please report it here.