Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The DOMActivate event is fired at an element when it becomes active, such as when it is clicked on using the mouse or a keypress is used to navigate to it.
Use the event name in methods like addEventListener().
addEventListener("DOMActivate", (event) => { })
Note: There is no onDOMActivate event handler property for this event.
A UIEvent. Inherits from Event.
This example listens for DOMActivate on a <button> element and displays its detail.
<button>Click</button>
const button = document.querySelector("button");
button.addEventListener("DOMActivate", (event) => {
button.textContent = `Click count: ${event.detail}`;
});
Note that detail of the DOMActivate event may have browser-specific behavior. It may either always be 0, or have similar behavior as the click event's detail (i.e., indicating the number of consecutive clicks).
| Specification |
|---|
| UI Events> # event-type-DOMActivate> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
DOMActivate_event |
1 | 79 | 1 | 15 | 1 | 18 | 4 | 14 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Element/DOMActivate_event