jquery next siblings

Posted by Contra on Stack Overflow See other posts from Stack Overflow or by Contra
Published on 2009-06-04T12:45:10Z Indexed on 2010/06/07 0:12 UTC
Read the original article Hit count: 145

Hi stackoverflow! (first post!)

Ive been trying to get this problem solved, but I cant seem to figure it out without some serious workarounds. if I have the following html code:

<ul>
<li class="parent"> headertext </li>
<li> text </li>
<li> text </li>
<li> text </li>
<li class="parent"> headertext </li>
<li> text </li>
<li> text </li>
</ul>

Now, how do I now just select the li's following the first parent (or second, for that matter)? Basically selecting an li with class=parent and the following siblings until it reaches another li with the parent class.

I could restructure the list with nested lists, but I dont want to do that.

Any suggestions?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery