How can I keep going through .next()s until I find the one with the class or id I want?
.next() only searches the immediately succeeding sibling but I want JQuery to keep going until it finds the one I want and only return that one. In the below case, I’d like JQuery to return the bottom div:
$('.toggler').nextUntilOneIWant('.expand_me')
<a class="toggler"></a>
<div> some stuff </div>
...divs...
<div class="expand_me"></div>
Try this, it will look for all the next siblings of
.toggleruntill it finds ‘.expand_me` and will give only the element where it found this match.