Example

Add text after input field to indicate marked text:

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

Try it yourself »

Definition and Usage

The select event occurs when the text is selected (marked) in a text area or text input element.

The select() method triggers the select event, or if the function parameter is set, it specifies what happens when a select event occurs.


Trigger the select Event

Trigger the select event for the selected element.

Syntax

$(selector).select()
Try it yourself »


Bind a Function to the select Event

Specifies a function to run when the select event is triggered for the selected element.

Syntax

$(selector).select(function)
Try it yourself »

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