W3cubDocs

/SVG

SVG Event Attributes

Event attributes always have their name starting with "on" followed by the name of the event for which they are intended. They specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified.

For every event type that the browser supports, SVG supports that as an event attribute, following the same requirements as for HTML event attributes.

The global event attributes are available on all SVG elements. Other event attributes are available on a case by case basis for each elements.

All event attribute are not animatable.

Attributes

Animation Event Attributes

onbegin, onend, onrepeat

Document Event Attributes

onabort, onerror, onresize, onscroll, onunload

Document Element Event Attributes

oncopy, oncut, onpaste

Global Event Attributes

oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting

Graphical Event Attributes

onactivate, onfocusin, onfocusout

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
oncancel No No No No No No No No No No No No
oncanplay No No No No No No No No No No No No
oncanplaythrough No No No No No No No No No No No No
onchange No No No No No No No No No No No No
onclick No No No No No No No No No No No No
onclose No No No No No No No No No No No No
oncuechange No No No No No No No No No No No No
ondblclick No No No No No No No No No No No No
ondrag No No No No No No No No No No No No
ondragend No No No No No No No No No No No No
ondragenter No No No No No No No No No No No No
ondragexit No No No No No No No No No No No No
ondragleave No No No No No No No No No No No No
ondragover No No No No No No No No No No No No
ondragstart No No No No No No No No No No No No
ondrop No No No No No No No No No No No No
ondurationchange No No No No No No No No No No No No
onemptied No No No No No No No No No No No No
onended No No No No No No No No No No No No
onerror No No No No No No No No No No No No
onfocus No No No No No No No No No No No No
oninput No No No No No No No No No No No No
oninvalid No No No No No No No No No No No No
onkeydown No No No No No No No No No No No No
onkeypress No No No No No No No No No No No No
onkeyup No No No No No No No No No No No No
onload No No No No No No No No No No No No
onloadeddata No No No No No No No No No No No No
onloadedmetadata No No No No No No No No No No No No
onloadstart No No No No No No No No No No No No
onmousedown No No No No No No No No No No No No
onmouseenter No No No No No No No No No No No No
onmouseleave No No No No No No No No No No No No
onmousemove No No No No No No No No No No No No
onmouseout No No No No No No No No No No No No
onmouseover No No No No No No No No No No No No
onmouseup No No No No No No No No No No No No
onmousewheel No No No No No No No No No No No No
onpause No No No No No No No No No No No No
onplay No No No No No No No No No No No No
onplaying No No No No No No No No No No No No
onprogress No No No No No No No No No No No No
onratechange No No No No No No No No No No No No
onreset No No No No No No No No No No No No
onresize No No No No No No No No No No No No
onscroll No No No No No No No No No No No No
onseeked No No No No No No No No No No No No
onseeking No No No No No No No No No No No No
onselect No No No No No No No No No No No No
onshow No No No No No No No No No No No No
onstalled No No No No No No No No No No No No
onsubmit No No No No No No No No No No No No
onsuspend No No No No No No No No No No No No
ontimeupdate No No No No No No No No No No No No
ontoggle No No No No No No No No No No No No
onvolumechange No No No No No No No No No No No No
onwaiting No No No No No No No No No No No No

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Events