This feature is not Baseline because it does not work in some of the most widely-used browsers.
The selectstart event of the Selection API is fired when a user starts a new selection.
If the event is canceled, the selection is not changed.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("selectstart", (event) => { })
onselectstart = (event) => { }
A generic Event.
// addEventListener version
document.addEventListener("selectstart", () => {
console.log("Selection started");
});
// onselectstart version
document.onselectstart = () => {
console.log("Selection started.");
};
| Specification |
|---|
| Selection API> # selectstart-event> |
| Selection API> # dom-globaleventhandlers-onselectstart> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
selectstart_event |
1 | 12 | 52 | 15 | 1.3 | 18 | 52 | 14 | No | 1.0 | 4.4 | No |
© 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/Node/selectstart_event