Using jQuery selectors, how to find an element, such as div
, immediately after another specific element? (not sibling, next()
can not help in this situation)
Use nextAll()
with a filter : http://api.jquery.com/nextAll/
Here's a demo : http://jsfiddle.net/JRPGh/1/
<div class='start'></div>
<div></div>
<div></div>
<div class='start'></div>
$('.start').nextAll('.start:first').css('background', 'red');
Maybe you are looking for the adjacent sibling selector:
http://www.w3.org/TR/CSS2/selector.html#adjacent-selectors
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With