jQuery select()Method
Examples
When text in the text area is selected, display an alert message:
$("input").select(function(){
alert("Text selected!");
});
alert("Text selected!");
});
Try it Yourself »
Definition and Usage
The select event occurs when text within a textarea or an input element of type text is selected (highlighted).
The select() method triggers the select event, or specifies a function to run when the select event occurs.
Syntax
Trigger the select event for the selected element:
$(selector).select()
Try it Yourself
Attach a function to the select event:
$(selector).select(function)
Try it Yourself
| Parameters | Description |
|---|---|
| function | Optional. Specifies the function to run when the select event is triggered. |
Other Extensions
jQuery Event Methods