tags:

views:

80

answers:

1

How to get all images in an html with src not empty.

I want to use jquery to select images which just have scr attr not empty.

how to write this jquery selector?

+2  A: 
$("img[src!='']")
Salty
this is not empty src? so how empty src should be?
Amr ElGarhy
img[src] will select any img element with it's src not empty.
Pim Jager
I was actually wrong, haha. I thought that too Pim -- I just tried it, but if you do that, it'll select elements like this as well:<img src="" />Which is obviously not the best. This works though, according to some testing:$("a[rel!='']")
Salty