HTML onselect event Attribute

❮ HTML Event Attributes

Example

<input type="text" value="Hello world!" onselect="myFunction()">

Meaning

The onselect attribute specifies the script run after some text has been selected in an element.


Standard Syntax

<element onselect="script">

Browser Support




Status







Attribute Values

Value Description
script Specifies the script to be run on onselect



Technical Details

Supported HTML elements:

<input type="file">, <input type="password">, <input type="text">, and <textarea>
❮ HTML Event Attributes