How to Find Img Tags Having src null. and deleting it
Posted
by
Anil
on Stack Overflow
See other posts from Stack Overflow
or by Anil
Published on 2010-07-27T12:28:22Z
Indexed on
2011/01/05
3:54 UTC
Read the original article
Hit count: 254
I need to delete or hide the Img tag or its parent when Img have src="".
I have a script but it is not working..
window.onload=function(){ var imgs = document.getElementsByTagName("img"); for(var i = 0; i < imgs.length; i++) { var img = imgs[i]; if(img.src==""){ img.parentNode.removeChild(img); } } }
Its is not finding the img having scr="". while in IE and Safari is is showing cross sign ( Red ).
Can anybody help.
Thanks.
© Stack Overflow or respective owner