Below is a demonstration of HTML code:
<div class="container">
<div class="zone">
<img class="thumb" alt="GG">
</div>
<div class="zone">
<span> </span>
</div>
<div class="zone">
<img class="thumb" alt="HH">
</div>
</div>
I am trying to select all div
elements with the class zone
that either have an img
element with the attribute alt=GG
, or no img
at all.
The current code snippet is not working as expected:
$('div.zone img[alt="GG"], :not(div.zone:has(img))')