I want to select the first ul
element after each anchor with the class some_anchors
.
HTML
<a class="some_anchors">
</a>
<ul id="ul_1">
</ul>
...
<a class="some_anchors">
</a>
<ul id="ul_2">
</ul>
...
<a class="some_anchors">
</a>
<ul id="ul_3">
</ul>
...
<a class="some_anchors">
</a>
<ul id="ul_4">
</ul>
...
The following code returns only the first ul
element:
console.log($(".some_anchors").nextAll('ul:first'));
How can I adjust the code so that it returns all ul
elements (ul_1
, ul_2
, ul_3
, ul_4
)?