HTML onselect イベント属性

❮ HTML イベント属性

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

<input type="text" onselect="myFunction()" value="Hello world!">
Try it Yourself ❯

定義と用法

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


ブラウザ・サポート

イベント属性
onselect Yes Yes Yes Yes Yes

HTML 4.01 と HTML5 の相違点

なし。


構文

<element onselect="script">

属性値

説明
script script は onselect で実行される

技術的詳細

サポートする HTML タグ: <input type="file">, <input type="password">, <input type="text">, <keygen>, and <textarea>

関連ページ

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


HTML Event Attributes HTML イベント属性