Const
Gets the previous sibling of each selected element optionally filtered by a selector.
Optional
If specified filter for siblings.
The previous nodes.
$('.orange').prev().hasClass('apple');//=> true Copy
$('.orange').prev().hasClass('apple');//=> true
https://api.jquery.com/prev/
Gets the previous sibling of each selected element optionally filtered by a selector.