HTML events¶
Here are some of the most common HTML events:
1. Window Events: These are triggered for the window object and apply to the <body> tag. Examples include onload (fires after the page is finished loading), onresize (fires when the browser window is resized), and onunload (fires once a page has unloaded or the browser window has been closed)1.
2. Form Events: These are triggered by actions inside an HTML form and apply to almost all HTML elements, but are most used in form elements. Examples include onsubmit (fires when a form is submitted), onchange (fires the moment when the value of the element is changed), and oninput (script to be run when an element gets user input)1.
3. Keyboard Events: These are triggered by user interaction with the keyboard. Examples include onkeydown (fires when a user is pressing a key), onkeypress (fires when a user presses a key), and onkeyup (fires when a user releases a key)1.
4. Mouse Events: These are triggered by user interaction with the mouse. Examples include onclick (fires on a mouse click on the element), ondblclick (fires on a mouse double-click on the element), onmousemove (fires when the mouse pointer is moving while it is over an element), and onmouseout (fires when the mouse pointer moves out of an element)1.
5. Drag and Drop Events: These are related to using the HTML Drag and Drop API2.
6. Animation Events: These are related to the Web Animation API and are used to respond to changes in animation status (e.g., when an animation starts or ends)3.
7. Clipboard Events: These are related to the Clipboard API and are used to notify when content is cut, copied, or pasted3.
8. Touch Events: These are related to user interaction with a touch device4.
Remember, these are just a few examples. There are many more events that can be handled in JavaScript3.