I have a list:
<ul>
<li class="myclass">...</li>
<li class="myclass">...</li>
<li class="myclass">...</li>
<li id="control">...</li>
<li class="myclass">...</li>
<li class="myclass">...</li>
<li class="myclass">...</li>
</ul>
How can I select all li elements after li[id="control"]?
In this example, I need to select last three li‘s
There’s a
.nextAll()which will get all siblings after a particular element selection, like this:You can try it out here
In this case the siblings are
<li>elements, so it’ll select all of them on the same level (not child<li>s beneath, if they exist).