Traversing Sideways in the DOM Tree

Explore different jQuery methods such as siblings(), next(), prev(), nextAll(), prevAll(), nextUntil(), and prevUntil() that traverse sideways in the DOM tree.

In this lesson, we will explore different methods in jQuery that allow the user to traverse sideways in the DOM tree. Given the initial selection, these methods allow the user to query for sibling elements.

We will work on the web page shown below throughout the lesson. The web page consists of a div element with five child elements. These five elements, a, span, p, h3, and ul are siblings of each other.

Get hands-on with 1200+ tech skills courses.