DOM Traversing

Functions for walking the DOM tree and filtering elements.


Match element selector

Check the current elements against a CSS selector.

jQuery: $.is()

Get parent element node

Getting the parent DOM node of an element.

jQuery: $.parent(), $.parents()

Get siblings of an element

Get the next, previous or all siblings of an element or retrieve siblings that match a given selector.

jQuery: $.siblings(), $.next(), $.nextAll(), $.prev, $.prevAll()

Get closest element by selector

Get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

jQuery: $.closest()

Select the children of an element

Getting the children of a DOM element.

jQuery: $.children()