There are many reasons why website images are not displayed, such as network problems, file itself problems, file URL problems, etc. When the image fails to load, the onerror event will be triggered. We can use this to effectively avoid the embarrassment of image loading failure!
js code