I want to select all div's of parents using jQuery, that don't have children with the class locked
Example code:
<div class='myparent'>
<div class='mychild locked'></div>
</div>
<div class='myparent'>
<div class='mychild locked'></div>
</div>
<div class='myparent'>
<div class='mychild'></div>
</div>
I feel like I'm really close:
$('div.myparent:not(:has(div[class=locked]))')
But that does not work.
You can just use class selector, there is no need for attribute selector DEMO
$('.myparent:not(:has(div.locked))')
Note:- you can do like this too:- $('.myparent:not(:has(.locked))')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With