Example
When the text in the element is selected, a section of JavaScript is executed:
<input type="text" onselect="showMsg() value="Hello world!">
Browser supports
IE
Firefox
Chrome
Safari
Opera
All major browsers support onselect attribute.
Definition and Usage
onselect attribute is triggered when the text in the element is selected. The
onselect attribute can be used within the following elements: file">, , , <keygen> and
Differences between HTML 4.01 and
HTML5None.
Syntax
<element onselect="script">
Attribute value
Value | Description |
script | Script to run when onselect occurs. |
The above is the detailed content of html event triggered when the text in the element is selected onselect. For more information, please follow other related articles on the PHP Chinese website!