Traversing Prev
π
2026-06-18 | π jQuery
# jQuery prev() Method
[ jQuery Traversing Methods](#)
## Example
Return the previous sibling element of each `
` element with the class name "start":
$(document).ready(function(){ $("li.start").prev().css({"color":"red","border":"2px solid red"}); });
Result:
ul (parent) * li (sibling)
* li (sibling)
* li (sibling with class name "start")
* li (sibling)
* li (sibling)
[Try it yourself Β»](#)
* * *
## Definition and Usage
The `prev()` method returns the previous sibling element of the selected element.
Sibling elements are elements that share the same parent element.
**Note:** This method only returns one element.
**DOM Tree:** This method traverses backwards through the previous sibling of DOM elements.
Related methods:
- Returns all previous sibling elements of the selected element
- Returns all previous sibling elements between two given arguments
* * *
## Syntax
$(_selector_).prev(_filter_)
| Parameter | Description |
| :--- | :--- |
| _filter_ | Optional. A selector expression to narrow down the search for the previous sibling element. |

## More Examples
[Select the previous sibling element of each `` element](#)
How to select the previous sibling element of each `
` element.
(#)
How to select the previous sibling `
` element of each `
` element.
* * jQuery Traversing Methods](#)