If it doesn't load normally when loading the img, I want to change it to text, but I only change the image with an error I'd like to.
If multiple images are loaded into a table,
$(".a img").error(function() { $("Error Images").addClass("error"); });
$(".error").replaceWith("<p>
Image Error</p>
");
I want to show it like this, but I don't know how to select only the image with the error.
I'd appreciate it if you could give me your opinion.
jquery img
Originally, I was going to recommend Lazy load, but Give on error event callback to each image and it will be solved at once. It's a secret that I just found out that there's an event like this.
Please refer to DEMO.
© 2024 OneMinuteCode. All rights reserved.