HTML
...
<a id="delete1" href="http://www.example.com">TEST</a>
<p>First</p>
<p>Second</p>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<div id="hidden-qsd">123</div>
...
JS
var id = $('#delete1').nextUntil("div[id^='hidden']").next().last().attr('id');
I’d like to get the id of the closest “div” starting with “hidden” located after the link “#delete1”.
This previous code is working but I think there is a simpler way to do it.
nextAll()is enoughexample jsbin: http://jsbin.com/usowej/3/edit
Note: if you have more than one element whose id is starting with
hiddenjust useto retrieve just the first occurence, see http://jsbin.com/usowej/4/edit