Sibling traversal moves horizontally in the DOM tree — to elements at the same level under the same parent. This is the technique behind tab switching, wizard step indicators, and ordered list manipulation where you need to operate on elements adjacent to a starting point.
Adjacent Siblings
.next() returns the immediately following sibling. .prev() returns the immediately preceding sibling. Both accept an optional selector to return the sibling only if it matches.
All Siblings
.nextAll(selector) collects all following siblings. .prevAll(selector) collects all preceding siblings. .siblings(selector) returns all siblings in both directions.
.next()— immediate next sibling.prev()— immediate previous sibling.nextAll()— all following siblings.prevAll()— all preceding siblings.siblings()— all siblings in both directions.nextUntil(sel)— following siblings up to (not including) a selector
.nextUntil() and .prevUntil() are especially useful for range-selection patterns where you want everything between two known landmark elements.