Execute a JavaScript if an error occurs when loading an image:
The onerror attribute fires when an error occurs while loading an external file (e.g. a document or an image).
Event Attribute | |||||
---|---|---|---|---|---|
onerror | Yes | Yes | Yes | Yes | Yes |
None.
Value | Description |
---|---|
script | The script to be run on onerror |
Supported HTML tags: | <img>, <input type="image">, <object>, <script> and <style> |
---|
HTML DOM reference: onerror event