Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2020.
Note: This feature is available in Web Workers.
The EventTarget() constructor creates a new EventTarget object instance.
Note: It is fairly rare to explicitly call this constructor. Most of the time, this constructor is used inside the constructor of an object extending the EventTarget interface, using the super keyword.
None.
A new instance of the EventTarget object.
This example implements a Counter class, with increment() and decrement() methods. It fires a custom "valuechange" event when either of these methods is called.
| DOM # ref-for-dom-eventtarget-eventtarget① |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 26, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.