i have the “c_500” id and i need the id from next parent with the classname “pp”.
i search something like …
$('#c_500').getNextParentWithClass('pp');
html
<div id="d_548" class="pp">
<div class="class_ft">
Blub<hr />
<div id="here">content</div>
<div id="c_500">content</div>
</div>
</div>
Thanks in advance!
Peter
You can use
.closest()with a.classselector to get the element, then just grab the ID, like this:You can give it a try here,
.closest()is the same behavior as.parents('pp:first'), walking up the parents until it finds the first one that matches the selector.