I have a certain div.box
that will be repeated several times, and some of them have a link ( a.link
) with a specific class.
Example:
<div class="box" data-id="1">
Primeiro texto
</div>
<div class="box" data-id="2">
Segundo texto <a class="link">Clique aqui</a>
</div>
<div class="box" data-id="3">
<a class="link">Clique aqui</a>
</div>
<div class="box" data-id="4">
Testando
</div>
Of the divs
shown above, I need to detect that, around a.link
, there are no texts. That is, from the above example it could return only div.box
whose data-id
equals 3
.
How can I detect this through jQuery?
That is, I have to make sure that the div.box
only contains within that element a.link
(and nothing else).