Node: selectstart event
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Theselectstart event of theSelection API is fired when a user starts a new selection.
If the event is canceled, the selection is not changed.
In this article
Syntax
Use the event name in methods likeaddEventListener(), or set an event handler property.
js
addEventListener("selectstart", (event) => { })onselectstart = (event) => { }Event type
A genericEvent.
Examples
js
// addEventListener versiondocument.addEventListener("selectstart", () => { console.log("Selection started");});// onselectstart versiondocument.onselectstart = () => { console.log("Selection started.");};Specifications
| Specification |
|---|
| Selection API> # selectstart-event> |
| Selection API> # dom-globaleventhandlers-onselectstart> |