Catch the unknown picture on <img> tag and set default image

MasterLuigi

New Member
I have this image tag : \[code\]<img id="viewerofinstore" src="http://stackoverflow.com/questions/15458255/{{filteredArray[imageIndex]}}" onError="this.style.visibility = 'hidden'" onload="this.style.visibility = 'visible'" width="297px" height="297px" />\[/code\]The \[code\]src\[/code\] of images are changed every second with other image, but there are some cases that the image is worng and an unknown image appear.I add the \[code\]"onError="this.style.visibility = 'hidden'"\[/code\] but sometimes I can see the unknown image for a second before its hidden.I want to catch the unknown image before display it and put a default image or hide the image.
 
Back
Top