I want to display only alt text if the image is not there in the path. It is displaying properly in Firefox, but in chrome it displays broken image link then alt text. I tried doing like this
I tried jquery
<script type="text/javascript">
function hideImage(img)
{
img.style.display = "none";
}
</script>
But it doesn't even display alt text. How to display alt text through this.
You can hook to the
error
event that gets raised when animg
element fails to load. You can then callreplaceWith()
to show thealt
text in its place. Try this: