Select Next Adjacent $("prev + next")

$("prev + next")

e.g. $("div + p")

$("prev + next") selects all next elements matching next selector preceded by sibling prev element matching prev selector.

For example, $("div + p") will find all <p> elements adjacent to & preceded by <div>.
<div>div1</div>
<p>p1</p>
<p>p2</p>
<div>div2</div>
<p>p3</p>

Code: Find all next square elements class="square" adjacent to and preceded by prev cirlce elements class='circle'

HTML
//CSS classes
.circle{ ... }
.square{ ... }

<div class="circle">circle</div>
<div class="square">square</div>
<div class="square">square</div>
<div class="circle">circle</div>
<div class="square">square</div>
jQuery code
$(".circle + .square"); // selects square preceded by cirlce
Demo

circle
square
square
circle
square
jQuery selector $("prev + next")