Search within TutorialsPark

Jquery Across the DOM Navigation


Learn to use jQuery select a start point and then across the DOM.


jQuery DOM : Navigating the DOM Across the Hierarchy

You can also navigate across the hierarchy inorder to select siblings of the element contained in a jQuery Object.


Table : Methods to Navigate Across the DOM Hierarchy

Method Description
next() To select the immediate next sibling for each element in the jQuery object.
nextAll() To select all of the next siblings for each element in the jQuery Object, optionally filtered by a selector.
nextUntil() To select the next sibling for each element up to an element that matches the selector or an element in the jQuery object.
prev() To Select the immediate previous sibling for each element in the jQuery object.
prevAll() To select all previous sibling for each element in the jQuery object, optionally filtered using a Selector
prevUntil(selector) To Select the prvious sibling for each element up to an element that matches the selector or an element in the jQuery Object.
siblings() To Select all of the siblings for each of the elements in the jQuery Object, optionally filtered using a Selector.

jQuery DOM : Selecting All Siblings

The jQuery Method siblings() is used to select all of the elements in a jQuery object.

If a selector is supplied, the elements will be filtered by testing whether they match the selector.

Example: Selecting All siblings()

Give it a TRY! » Note: The result of this call is JQuery Object selecting all items except earth


jQuery DOM : Selecting the Next and Previous Siblings

The jQuery methods prev() and next() are used to select the immediate previous and next siblings repectively of the jQuery Object.

Example: DOM Navigation using jQuery Method prev() and next()

Give it a TRY! » Note:The method selects the immediate previous and next sibling of the jQuery Object.


jQuery DOM : Selecting all the Next and Previous Siblings

The jQuery methods nextAll() and prevAll() is used to select all the next and previous siblings for each element in the jQuery Object.

A selector can optionally be used to filter elements.

Example: Selecting all the Next and Previous Siblings

Give it a TRY! » Note:Both the methods selects all the siblings of the jQuery Object.


jQuery Selecting Siblings using nextUntil() and prevUntil() Method

The jQuery methods of nextUntil() and prevUntil() is used to select the next and previous siblings respectively of the jQuery Object, upto an element that matches the selector.

Example: jQuery Selecting Siblings using nextUntil() and prevUntil() Method

Give it a TRY! » Note: The result can optionally be filtered by a selector as a second argument to the method.