Execute a JavaScript when some text has been selected:
The onselect event occurs after some text has been selected in an element.
In HTML:
In JavaScript:
| Parameter | Description |
|---|---|
| SomeJavaScriptCode | Required. Specifies a JavaScript to be executed when the event occurs |
![]()
The onselect event is supported in all major browsers.
The onselect attribute can be used with: <input type="file">, <input type="password">, <input type="text">, <keygen>, and <textarea>.
Event Object
Your message has been sent to W3Schools.