checking if element with given attribute exists in wrapper
Hi all,
I'm cloning an image from one div to another. But before I append it to the other div I'd like to check whether the img I'm about to append already exists in the other div or not.
Now I know that for the basics it's checked easy enough with;
-
if($('#myDiv').length)
But this goes beyond that, as you need to check if the attribute (src) of the to be cloned img already exists in the div it is about to get cloned to. I've tried several options :has(img[src="xx"]), an each loop with .is(img[src=xx]), even .find('img[src="xx"]') but all with no success. Now I'm pretty sure it's me, but I don't know what I'm doing wrong, who can help me with this?
Thanks
