DOM event
An object the browser sends to your code when something happens, such as a click, a key press or a finished download.
In more detail
Events are dispatched to a target and travel through the DOM in phases, calling each registered listener with the event object. The object carries details such as target, type and methods like preventDefault.
Related terms
- event listener — A function registered with addEventListener that the browser calls whenever a given event happens on an element or on window.
- event propagation — The journey of an event through the DOM: down from the window to the target (capturing), at the target, then back up (bubbling).
- event.target — The event property holding the element where the event actually started, such as the icon inside a button that was clicked.
- dispatchEvent() — The method that sends an event object to a target so its listeners run, synchronously, before the call returns.
Taught in
- Event Phases: Capturing, Target And Bubbling Demystified — Frontend Architecture & Web Platform
- Event Delegation: Memory-Efficient Interaction Handlers — Frontend Architecture & Web Platform
- CustomEvent Dispatching And Decoupled Component Event Buses — Frontend Architecture & Web Platform