Latest web development tutorials

HTML onselect event properties

HTML Event Attributes HTML Event Attributes

Examples

When selecting <input> elements in the text after the implementation of JavaScript:

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

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support onselect event attributes


Definition and Usage

onselect properties selected text element after the trigger.

onselect property can be used for the following elements: <input type = "file">, <input type = "password">, <input type = "text">, <keygen>, and <textarea>.


Differences between HTML 4.01 and HTML5

no.


grammar

<elementonselect=" script ">

Property Value

描述
script 规定该onselect事件触发时执行的脚本。


HTML Event Attributes HTML Event Attributes