JQuery prev()
Syntax
The prev()
method in jQuery selects the immediately preceding sibling element of the currently selected element.
$(selector).prev();
Use
The prev()
method is most commonly used to target the previous sibling element of a specific HTML element. It can be used to retrieve and manipulate the content of a particular element in your web page's DOM.
Example
Here is an example of using prev()
to target and manipulate the content of the previous sibling element of a specific HTML element: