Easy Tutorial
❮ Jsref String Includes Dom Obj Frame ❯

onselect Event

Event Object

Example

Execute a JavaScript code when text is selected:


Definition and Usage

The onselect event occurs when text in a text field is selected.

Syntax

In HTML:

In JavaScript:

Parameter Description
SomeJavaScriptCode Required. Specifies the JavaScript to be executed when the event occurs.

Browser Support

All major browsers support the onselect event.


onselect in HTML

The onselect attribute can be used with: <input type="file">, <input type="password">, <input type="text">, <keygen>, and <textarea>.

❮ Jsref String Includes Dom Obj Frame ❯