如何找到一些元素但下一个元素?
HTML:
<div id="container">
<div class="box id_1">1</div>
<div class="box id_2">2</div>
<div class="break">{BREAK}</div>
<div class="box id_1">1</div> // <--- THIS !
<div class="box id_2">2</div> // <--- and should work when I detect in THIS also!
</div>
我使用.next()
并且.filter()
似乎它不起作用:(
$('#container > .box').next('.break').filter('.id_1').addClass('found');
游乐场:http: //jsfiddle.net/l2aelba/2zBWv/