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 ).
You can user jQuery for that 🙂
The workaround is set the style of the div container where there is the news as display:none; then once th for each loop is executed you set the div as visible.
here you have a code mockup..