Affiliate link
HTML - Events
HTML events are fired arise from user interactions such as mouse click, drag, form submission, resize windows. JavaScript function will be triggered from HTML events.
The HTML events are listed below,
HTML - Window Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| onafterprint | After the HTML document has started printing or the print preview dialog box has been closed. | Event |
| onbeforeprint | When the HTML document is previewed for printing. | Event |
| onbeforeunload | Before the HTML document unloaded. | BeforeUnloadEvent |
| onerror | When the HTML document failed to load. | Event/UIEvent |
| onhashchange | When the #hash URL has changed. | HashChangeEvent |
| onload | When the HTML document is loaded with all resources. | Event |
| onmessage | When the window receives a message. | MessageEvent |
| onmessageerror | When the window receives a message that cannot be deserialized. | MessageEvent |
| onoffline | When the network status is offline. | Event |
| ononline | When the network status is online. | Event |
| onpagehide | When user go to other URL. | PageTransitionEvent |
| onpageshow | When user go to page URL. | PageTransitionEvent |
| onpopstate | When the active history entry of the browser changes. | PopStateEvent |
| onresize | When the window is resized. | UIEvent |
| onstorage | When a storage(localStorage) has been modified. | StorageEvent |
| onunload | When the HTML document is unloaded. | Event |
HTML - Form Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| onblur | When element lost focus. | |
| onchange | When the value of the element changed. | |
| oncontextmenu | When a context menu is displayed. | |
| onfocus | When an element get focused. | |
| oninput | When an element get input from user. | |
| oninvalid | When an element is invalid. | |
| onreset | When the form get reset. | |
| onsearch | When the search input get input from user. | |
| onselect | When the text of an element selected. | |
| onsubmit | When the form is going to be submitted. |
Affiliate link
HTML - Keyboard Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| onkeydown | When user press a key. | |
| onkeypress | When user pressed a key. | |
| onkeyup | When user released a key. |
HTML - Mouse Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| onclick | When mouse clicked on an element. | |
| ondblclick | When mouse double-clicked on an element. | |
| onmousedown | When mouse is pressed on an element. | |
| onmousemove | When mouse is moving on an element. | |
| onmouseout | When mouse is moved out of an element. | |
| onmouseover | When mouse is moved over an element. | |
| onmouseup | When mouse is released on an element. | |
| onmousewheel | Depreciated. Use onwheel attribute. | |
| onwheel | When mouse wheel is rolled up/down on an element. |
HTML - Drag Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| ondrag | When an element is dragging on mouse pressed. | |
| ondragend | When an element is dragged on mouse released. | |
| ondragenter | When the dragged element is dragged to an element. | |
| ondragleave | When the dragged element is dragged out of an element. | |
| ondragover | When the dragged element is dragged over to an element. | |
| ondragstart | When the element is getting dragged. | |
| ondrop | When the dragged element is dropped to an element. | |
| onscroll | When the element's scrollbar is scrolled. |
HTML - Clipboard Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| oncopy | When the user do a copy action on an element. | |
| oncut | When the user do a cut action on an element. | |
| onpaste | When the user do a paste action to an element. |
Affiliate link
HTML - Media Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| onabort | When the media resource not fully loaded. | |
| oncanplay | When the media resource can be played without loading fully. | |
| oncanplaythrough | When the media resource can be played without stopping for buffer. | |
| oncuechange | When currently playing cue changed. | |
| ondurationchange | When the duration attribute modified. | |
| onemptied | When the media resource become empty due to load() method executed. | |
| onended | When the media resource playback ended. | |
| onerror | When the media resource unable to load due to an error. | |
| onloadeddata | When the playback position of the media resource is loaded. | |
| onloadedmetadata | When the metadata is loaded. | |
| onloadstart | When media resource start to load. | |
| onpause | When pause() method is called and the media element's paused property is changed to true. | |
| onplay | When the media element's paused property is changed to false. | |
| onplaying | When playback is started or restarted. | |
| onprogress | When the media resource is loading. | |
| onratechange | When the playback rate is changed. | |
| onseeked | When seek operation completed, playback position is changed, and seeking attribute changed to false | |
| onseeking | When seek operation started and seeking attribute is changed to true. | |
| onstalled | When the media resouce not able to load by user agent. | |
| onsuspend | When media resouce loading has been suspended. | |
| ontimeupdate | When the currentTime attribute is updated. | |
| onvolumechange | When the volume is changed. | |
| onwaiting | When playback is stopped because temporary lack of media resource. |
HTML - Others Events attributes
| Event attributes | Description | Event type |
|---|---|---|
| ontoggle | When the state of the element is toggled. |
Affiliate link
Affiliate link



