jQuery: Match elements between .class and items // Combine nextAll() and nextUntil() -
i have dom
<div class="c">c</div> <div class="a">match me not</div> <div class="c">c</div> <div class="c wrapper">c .wrapper</div> <div class="a">match me!</div> <div class="a">match me!</div> <div class="c">c</div> <div class="a">match me not</div> <div class="c">c</div>
and need match .a
after .wrapper
until next .c
nextall()
matches after
nextuntil()
selects lastly element
test: http://jsfiddle.net/d4sss/1/
use way
$(".wrapper").nextuntil('.c').filter(".a").addclass("matched");
demo
jquery nextuntil
No comments:
Post a Comment