Select All Previous Siblings .prevAll([selector])

.prevAll([selector])

selector is optional
e.g. $("span").prevAll()

.prevAll([selector]) will select all previous siblings, if selector is provided then they should match selector.

Example 1: $("span").prevAll() will find all previous siblings of each <span>.
<b>A</b>
<div>B</div>
<div>C</div>
<span>D</span>
<div>E</div>


Example 2: $("span").prevAll("div") will find all previous siblings of type <div> for each <span>.
<b>A</b>
<div>B</div>
<div>C</div>
<span>D</span>
<div>E</div>

jQuery traversing tree .prevAll([selector])