HTMLonselectイベント属性

❮HTMLイベント属性

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

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

定義と使用法

onselect属性は、要素でテキストが選択された後に発生します。


ブラウザのサポート

Event Attribute
onselect Yes Yes Yes Yes Yes

構文

<element onselect="script">

属性値

Value Description
script The script to be run on onselect

技術的な詳細

サポートされているHTMLタグ: <input type = "file">、<input type = "password">、<input type = "text">、および<textarea>

関連ページ

HTML DOMリファレンス:onselectイベント


❮HTMLイベント属性