- Courses
- 💻Programming Languages
- 🌐JavaScript
- DOM & Events
- HTML events
HTML events
By Enrico Hochkoeppler
Web Developer & TutoriaLibre Founder
Here are some of the most common HTML events:
info
The following events are all specific to particular HTML elements. If you are a beginner in HTML, you can check this helpful introduction to HTML for beginners offered by Website Planet. And if you would like to have a course in HTML on our site, instead, contact us through our feedback form.
- Window Events: These are triggered for the window object and apply to the
<body>tag. Examples includeonload(fires after the page is finished loading),onresize(fires when the browser window is resized), andonunload(fires once a page has unloaded or the browser window has been closed). - 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), andoninput(script to be run when an element gets user input). - 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), andonkeyup(fires when a user releases a key). - 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), andonmouseout(fires when the mouse pointer moves out of an element). - Drag and Drop Events: These are related to using the HTML Drag and Drop API.
- 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).
- Clipboard Events: These are related to the Clipboard API and are used to notify when content is cut, copied, or pasted.
- Touch Events: These are related to user interaction with a touch device.
Remember, these are just a few examples. There are many more events that can be handled in JavaScript.
Found this helpful? Share the knowledge...
... or support this project to keep it alive!
Previous
Animations
Next
Event handling and propagation
