You can use the onerror event which is automatically triggered when an image fails to load properly.
For Example:
<img src="http://cdn.qhub.com/image.png" alt="image" onerror="this.parentNode.removeChild(this)" />
Or you can use this for Firefox/Chrome:
Var imgs = document.getElementsByTagName('img')
for(var i=0,j=imgs.length;i<j;i++){
imgs[i].onerror = function(e){
this.parentNode.removeChild(this);
}
}
For Example:
<img src="http://cdn.qhub.com/image.png" alt="image" onerror="this.parentNode.removeChild(this)" />
Or you can use this for Firefox/Chrome:
Var imgs = document.getElementsByTagName('img')
for(var i=0,j=imgs.length;i<j;i++){
imgs[i].onerror = function(e){
this.parentNode.removeChild(this);
}
}