Easy Tutorial
❮ Misc Deferred Always Misc Isarray ❯

jQuery prevUntil() Method

jQuery Traversing Methods

Example

Returns all sibling elements between two <li> elements with class names "start" and "stop":

Result:


Definition and Usage

The prevUntil() method returns all preceding sibling elements of each element between selector and stop.

Sibling elements are elements that share the same parent.

DOM Tree: This method traverses backward along the sibling elements of the DOM elements.

Note: If both parameters are empty, the method will return all preceding sibling elements (same as the prevAll() method).

Related methods:


Syntax

Parameter Description
stop Optional. A selector expression, element, or jQuery object indicating where to stop the search for matching sibling elements before the elements.
filter Optional. A selector expression that narrows down the search scope for sibling elements between the selector and stop. <br> <br> Note: To return multiple sibling elements, separate each expression with a comma.

More Examples

Narrow Down the Search

Return Multiple Sibling Elements

DOM

Using DOM with Two Parameters


jQuery Traversing Methods

❮ Misc Deferred Always Misc Isarray ❯