Document: 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.
Bubbles | Yes |
---|---|
Cancelable | Yes |
Interface | Event |
Event handler property | onselectstart |
Examples
// addEventListener version
document.addEventListener('selectstart', () => {
console.log('Selection started');
});
// onselectstart version
document.onselectstart = () => {
console.log('Selection changed.');
};
Specifications
Specification |
---|
Selection API # selectstart-event |
Browser compatibility
BCD tables only load in the browser