I have some html that looks like this:
<div class="block">
<div id="item1"></div>
<div id="item2"></div>
</div>
<div class="block">
<div id="item3"></div>
</div>
I'm trying to check to see if my div will contain a specific element. I need to loop though each block, then get each item.
What I've got so far
$('.block:has(div)').each(function() {
// do something with the block
});
Which is great, because it will return all the blocks that have items in them. But I need something along the lines of
$('.block:has(div)').each(function() {
$('current place in loop' + li).each(function() {
// do something with each item element, before the block loop has finished
});
});
Any ideas?