HTML onselect Attribute

❮ HTML 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




Applies to:

The onselect attribute can be used on the following element:

Element Attribute
All HTML elements. onselect






Attribute Values

Value Description
script Specifies the script to be run on onselect
❮ HTML Attributes