Mouse Events
| Attribute | Description |
|---|---|
| onclick | Fires when the user clicks on an element |
| ondblclick | Fires when the user double-clicks on an element |
| onmousedown | Fires when a mouse button is pressed down on an element |
| onmouseup | Fires when a mouse button is released over an element |
| onmousemove | Fires when the mouse pointer is moving while it is over an element |
| onmouseover | Fires when the mouse pointer moves over an element |
| onmouseout | Fires when the mouse pointer moves out of an element |
| onmouseenter | Fires when the mouse pointer enters an element (does not bubble) |
| onmouseleave | Fires when the mouse pointer leaves an element (does not bubble) |
| oncontextmenu | Fires when the user right-clicks on an element to open context menu |
Keyboard Events
| Attribute | Description |
|---|---|
| onkeydown | Fires when a user is pressing a key |
| onkeyup | Fires when a user releases a key |
| onkeypress | Fires when a user presses a key (deprecated, use onkeydown instead) |
Form Events
| Attribute | Description |
|---|---|
| onsubmit | Fires when a form is submitted |
| onreset | Fires when a form is reset |
| onchange | Fires when the value of an element has been changed |
| oninput | Fires when an element gets user input |
| onfocus | Fires when an element gets focus |
| onblur | Fires when an element loses focus |
| onselect | Fires after some text has been selected in an element |
| oninvalid | Fires when an input element is invalid |
| onsearch | Fires when the user writes something in a search field |
Window Events
| Attribute | Description |
|---|---|
| onload | Fires after the page has finished loading |
| onunload | Fires once a page has unloaded (or the browser window has been closed) |
| onbeforeunload | Fires before the document is about to be unloaded |
| onresize | Fires when the browser window has been resized |
| onscroll | Fires when an element's scrollbar is being scrolled |
| onerror | Fires when an error occurs while loading an external file |
| onpageshow | Fires when a user navigates to a webpage |
| onpagehide | Fires when a user navigates away from a webpage |
Media Events
| Attribute | Description |
|---|---|
| onplay | Fires when the media has been started or is no longer paused |
| onpause | Fires when the media has been paused |
| onplaying | Fires when the media is playing after having been paused or stopped |
| onended | Fires when the media has reached the end |
| onvolumechange | Fires when the volume has been changed |
| ontimeupdate | Fires when the playing position has changed |
| onloadeddata | Fires when media data is loaded |
| onloadedmetadata | Fires when metadata has been loaded |
| oncanplay | Fires when the browser can start playing the media |
| oncanplaythrough | Fires when the browser can play through the media without stopping |
Drag Events
| Attribute | Description |
|---|---|
| ondrag | Fires when an element is being dragged |
| ondragstart | Fires when the user starts to drag an element |
| ondragend | Fires when the user has finished dragging an element |
| ondragenter | Fires when the dragged element enters a drop target |
| ondragleave | Fires when the dragged element leaves a drop target |
| ondragover | Fires when the dragged element is over a drop target |
| ondrop | Fires when the dragged element is dropped on a drop target |
Clipboard Events
| Attribute | Description |
|---|---|
| oncopy | Fires when the user copies the content of an element |
| oncut | Fires when the user cuts the content of an element |
| onpaste | Fires when the user pastes some content in an element |
HTML Free Codes