MDN self-hosted library · e01.org

SVGElement: error event

SVG

SVG

The error event is fired when an SVG element does not load properly or when an error occurs during script execution.

This basically implements the standard error DOM event.

This event is not cancelable.

Syntax

Use the event name in addEventListener():

addEventListener("error", (event) => { })

Alternatively, assign to the event handler property of the interface:

onerror = (event) => { }

Event type

A generic Event.

Examples

svgElem.addEventListener("error", () => {
  console.log("SVG not loaded properly.");
});

Specifications

Browser compatibility