jQuery select() method
Example
Display an alert message when text in the text area is selected:
$("input").select(function(){
alert("Text selected!");
});
Try it »
Definition and Usage
The select event occurs when text in a textarea or a text-type input element is selected (highlighted).
The select() method triggers the select event, or specifies a function to run when a select event occurs.
Syntax
Trigger the select event of the selected element:
$(
selector
).select()
Try it
Add a function to the select event:
$(
selector
).select(
function
)
Try it
| Parameters | Description |
|---|---|
| function | Optional. Specifies the function to run when the select event is triggered. |
jQuery event methods