HTML onselectstart Event Attribute
HTML Event AttributeThis event attribute is supported in some modern browsers, but not all.
Description
The onselectstart event attribute runs a script when the user starts a new text selection, for example by pressing the mouse button and starting to drag over text.
The event bubbles and is cancelable: calling event.preventDefault() (or returning false from the attribute) stops the selection from starting. The CSS user-select: none property is usually a better way to make text unselectable, but onselectstart can decide at the moment the selection begins. Use onselectionchange to react to the selection as it changes.
Syntax
<element onselectstart="script">
Values
- scriptThe name of the script to use when the event has been triggered.
Example
Browser Support
The following information will show you the current browser support for the HTML onselectstart event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.
This event attribute is supported in some modern browsers, but not all.
Desktop





Tablets & Mobile






-
Supported Unknown Not supported
Sponsors
Password Manager
PasswordPal stores your passwords and private notes behind encryption that happens in your browser.
Copy Paste List
Copy and paste or download lists in your preferred format, including plain text, PDF, or HTML.
Unicode Characters & Emojis
Search all Unicode characters and emojis plus other tools.
Check Shortened URLs
Expand shortened URLs to view the destination link.
Advertise Here
Advertise your company and products here!