HTMLonselect属性_


定義と使用法

要素でテキストが選択された後、onselect属性が起動します。


に適用されます

このonselect属性はイベント属性の一部であり、任意のHTML要素で使用できます。

要素 イベント
すべてのHTML要素 onselect

入力例

<input>要素でテキストが選択された後にJavaScriptを実行します。

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

ブラウザのサポート

Event Attribute
onselect Yes Yes Yes Yes Yes