jQuery select()メソッド

❮jQueryイベントメソッド

テキストフィールドでテキストが選択されたときにメッセージを警告します。

$("input").select(function(){
  alert("Text marked!");
});

定義と使用法

selectイベントは、テキスト領域またはテキストフィールドでテキストが選択(マーク)されたときに発生します。

select()メソッドは、selectイベントをトリガーするか、selectイベントが発生したときに実行する関数をアタッチします。


構文

選択した要素の選択イベントをトリガーします。

$(selector).select()

selectイベントに関数をアタッチします。

$(selector).select(function)

Parameter Description
function Optional. Specifies the function to run when the select event is triggered

❮jQueryイベントメソッド