Is there a way to select an HTML element with a specific attribute, regardless of whether that attribute has a value or not? I have seen similar questions regarding elements with attribute values, but nothing based solely on the existence of the attribute itself.
Consider this sample HTML:
<div id="id1">
<div class="c1"></div>
<div class="c2" an-attribute ></div>
<div class="c3"></div>
</div>
How can I target the div
within #id1
that contains the attribute an-attribute
? It may not be in a specific order compared to other divs
, but it will always be within #id1
.