Node: selectstart event
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.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("selectstart", (event) => {});
onselectstart = (event) => {};
Event type
A generic Event
.
Examples
js
// addEventListener version
document.addEventListener("selectstart", () => {
console.log("Selection started");
});
// onselectstart version
document.onselectstart = () => {
console.log("Selection started.");
};
Specifications
Specification |
---|
Selection API # selectstart-event |
Selection API # dom-globaleventhandlers-onselectstart |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
selectstart event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.