html event triggered when the text in the element is selected onselect

黄舟
Release: 2017-11-04 13:50:05
Original
3250 people have browsed it

Example

When the text in the element is selected, a section of JavaScript is executed:

<input type="text" onselect="showMsg() value="Hello world!">
Copy after login

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