Event Attribute | Description |
onabort |
Script to be run on abort |
onafterprint |
Script to be run after the document is printed |
onbeforeprint |
Script to be run before the document is printed |
onbeforeunload |
Script to be run when the document is about to be unloaded |
onblur |
Fires the moment that the element loses focus |
oncanplay |
Script to be run when a file is ready to start playing (when it has buffered enough to begin) |
oncanplaythrough |
Script to be run when a file can be played all the way to the end without pausing for buffering |
onchange |
Fires the moment when the value of the element is changed |
onclick |
Fires on a mouse click on the element |
oncontextmenu |
Script to be run when a context menu is triggered |
oncopy |
Fires when the user copies the content of an element |
oncuechange |
Script to be run when the cue changes in a <track> element |
oncut |
Fires when the user cuts the content of an element |
ondblclick |
Fires on a mouse double-click on the element |
ondrag |
Script to be run when an element is dragged |
ondragend |
Script to be run at the end of a drag operation |
ondragenter |
Script to be run when an element has been dragged to a valid drop target |
ondragleave |
Script to be run when an element leaves a valid drop target |
ondragover |
Script to be run when an element is being dragged over a valid drop target |
ondragstart |
Script to be run at the start of a drag operation |
ondrop |
Script to be run when dragged element is being dropped |
ondurationchange |
Script to be run when the length of the media changes |
onemptied |
Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) |
onended |
Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") |
onerror |
Script to be run when an error occurs when the file is being loaded |
onfocus |
Fires the moment when the element gets focus |
onhashchange |
Script to be run when there has been changes to the anchor part of the a URL |
oninput |
Script to be run when an element gets user input |
oninvalid |
Script to be run when an element is invalid |
onkeydown |
Fires when a user is pressing a key |
onkeypress |
Fires when a user presses a key |
onkeyup |
Fires when a user releases a key |
onload |
Fires after the page is finished loading |
onloadeddata |
Script to be run when media data is loaded |
onloadedmetadata |
Script to be run when meta data (like dimensions and duration) are loaded |
onloadstart |
Script to be run just as the file begins to load before anything is actually loaded |
onmessage |
Script to be run when the message is triggered |
onmousedown |
Fires when a mouse button is pressed down on an element |
onmousemove |
Fires when the mouse pointer is moving while it is over an element |
onmouseout |
Fires when the mouse pointer moves out of an element |
onmouseover |
Fires when the mouse pointer moves over an element |
onmouseup |
Fires when a mouse button is released over an element |
onmousewheel |
Deprecated. Use the onwheel attribute instead |
onoffline |
Script to be run when the browser starts to work offline |
ononline |
Script to be run when the browser starts to work online |
onpagehide |
Script to be run when a user navigates away from a page |
onpageshow |
Script to be run when a user navigates to a page |
onpaste |
Fires when the user pastes some content in an element |
onpause |
Script to be run when the media is paused either by the user or programmatically |
onplay |
Script to be run when the media is ready to start playing |
onplaying |
Script to be run when the media actually has started playing |
onpopstate |
Script to be run when the window's history changes |
onprogress |
Script to be run when the browser is in the process of getting the media data |
onratechange |
Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode) |
onreset |
Fires when the Reset button in a form is clicked |
onresize |
Fires when the browser window is resized |
onscroll |
Script to be run when an element's scrollbar is being scrolled |
onsearch |
Fires when the user writes something in a search field (for <input="search">) |
onseeked |
Script to be run when the seeking attribute is set to false indicating that seeking has ended |
onseeking |
Script to be run when the seeking attribute is set to true indicating that seeking is active |
onselect |
Fires after some text has been selected in an element |
onstalled |
Script to be run when the browser is unable to fetch the media data for whatever reason |
onstorage |
Script to be run when a Web Storage area is updated |
onsubmit |
Fires when a form is submitted |
onsuspend |
Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason |
ontimeupdate |
Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media) |
ontoggle |
Fires when the user opens or closes the <details> element |
onunload |
Fires once a page has unloaded (or the browser window has been closed) |
onvolumechange |
Script to be run each time the volume is changed which (includes setting the volume to "mute") |
onwaiting |
Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data) |
onwheel |
Fires when the mouse wheel rolls up or down over an element |