Const
Gets all the preceding siblings of each selected element, optionally filtered by a selector.
Optional
If specified filter for siblings.
The previous nodes.
$('.pear').prevAll();//=> [<li class="orange">Orange</li>, <li class="apple">Apple</li>]$('.pear').prevAll('.orange');//=> [<li class="orange">Orange</li>] Copy
$('.pear').prevAll();//=> [<li class="orange">Orange</li>, <li class="apple">Apple</li>]$('.pear').prevAll('.orange');//=> [<li class="orange">Orange</li>]
https://api.jquery.com/prevAll/
Gets all the preceding siblings of each selected element, optionally filtered by a selector.