How to choose links containing text and links without an image

I am new to jQuery. For me, this is not a problem using xpath expressions, but how can I do this with "jQuery"?

In the following example:

<stuff>
<a href="target.html">ASDF</a>
<a href="target.html"><img src="asdf.png"/></a>
</stuff>

How can I select text links with jQuery and leave the links with img tags intact?

Help me j Query kenobi, you are my only hope;)

Princess Leah

+3
source share
2 answers

$ ('a: no (: is (IMG)))

+3
source
$('a:not(img)')  

That should do the job.

+1
source

Source: https://habr.com/ru/post/1707114/


All Articles