onselectstart event | selectstart event
Occurs at the start of a selection process.
The onselectstart event is cancelable, if you cancel it, the selection process does not start.
For a cross-browser solution, if you want to disable the selection for an element or for the entire document,
use the unselectable property in Internet Explorer and Opera and the MozUserSelect and webkitUserSelect style properties in Firefox, Google Chrome and Safari.
How to register:
In HTML:
In JavaScript:
<ELEMENT onselectstart="handler"> |
In JavaScript:
object.onselectstart = handler; | |||||||||||
object.addEventListener ("selectstart", handler, useCapture); |
| ||||||||||
object.attachEvent ("onselectstart", handler); |
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers.
The properties of the event object contain additional information about the current event.
To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript. |
Basic information:
Bubbles | Yes |
Cancelable | Yes |
Event object | Event |
Actions that invoke the onselectstart event:
The order of events related to the onselectstart event:
- onselectstart
- onselect
- onselectionchange
Example HTML code 1:
This example illustrates the use of the onselectstart event:
|
||||
<div>The selection process can start in this text.</div> <br /> <div onselectstart="return false">The selection process cannot start in this text.</div> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
document
HTML elements:
a, abbr, acronym, address, applet, area, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, html, i, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, map, marquee, menu, nobr, noframes, object, ol, option, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments