Traversing Prevuntil
# jQuery prevUntil() Method
[ jQuery Traversing Methods](#)
## Example
Return all sibling elements between the two `` elements with class names "start" and "stop":
$(document).ready(function(){
$("li.start").nextUntil("li.stop").css({"color":"red","border":"2px solid red"});
});
Result:
ul (parent) * li (sibling with class name "stop")
* li (sibling)
* li (sibling)
* li (sibling)
* li (sibling with class name "start")
* li (sibling)
* li (sibling)
[Try it Β»](#)
* * *
## Definition and Usage
The `prevUntil()` method returns all sibling elements between the `_selector_` and the `_stop_`.
Sibling elements are elements that share the same parent element.
**DOM Tree:** This method traverses backward through the sibling elements of a DOM element.
**Note:** If both parameters are empty, this method returns all sibling elements before the element (same as the [prevAll()](#) method).
Related methods:
- Returns the previous sibling element of the selected element
- Returns all sibling elements before the selected element
* * *
## Syntax
$(_selector_).prevUntil(_stop,filter_)
| Parameter | Description |
| :--- | :--- |
| _stop_ | Optional. A selector expression, element, or jQuery object indicating where to stop searching for matching sibling elements before the element. |
| _filter_ | Optional. A selector expression that narrows the search for sibling elements between the `_selector_` and the `_stop_`. **Note:** To return multiple sibling elements, separate each expression with a comma. |

## More Examples
(#)
Use two parameters to filter the search for sibling elements before each element between the two parameters.
(#)
How to return multiple sibling elements between two parameters.
(#)
Use a DOM element instead of a selector to return all sibling elements between two given parameters.
(#)
Use DOM with two parameters instead of a selector to filter the search for sibling elements before each element between the two parameters.
* * jQuery Traversing Methods](#)
YouTip