Events
Events fire when significant things happen in the page, such as an image loading or a user clicking. You can use the addEventListener()
method on objects that receive events (event targets), such as windows, documents, and elements, to set a function to be called when an event fires.
To learn more, see
CustomEvent,
CustomEvent: CustomEvent() constructor,
CustomEvent: detail property,
Event,
Event: Event() constructor,
Event: bubbles property,
Event: cancelable property,
Event: currentTarget property,
Event: defaultPrevented property,
Event: eventPhase property,
Event: isTrusted property,
Event: preventDefault() method,
Event: stopImmediatePropagation() method,
Event: stopPropagation() method,
Event: target property,
Event: timeStamp property,
Event: type property,
EventTarget,
EventTarget: EventTarget() constructor,
EventTarget: addEventListener() method,
EventTarget: dispatchEvent() method,
EventTarget: removeEventListener() method at MDN.
Compatibility
- Chrome 90 Released on 2021-04-13
- Chrome Android 90 Released on 2021-04-13
- Edge 90 Released on 2021-04-15
- Firefox 86 Released on 2021-02-23
- Firefox for Android 86 Released on 2021-02-23
- Safari 15 Released on 2021-09-20
- Safari on iOS 15 Released on 2021-09-20
Specifications
- HTML Standard (#events-2), from HTML Workstream (WHATWG).
- DOM Standard (#interface-customevent), from DOM Workstream (WHATWG).
- DOM Standard (#interface-eventtarget), from DOM Workstream (WHATWG).