Latest web development tutorials

jQuery select () method

jQuery Event Methods jQuery Event Methods

Examples

When text in a text field is selected, a message is displayed:

$ ( "Input"). Select (function () {
alert ( "text is selected!");
});

try it"

Definition and Usage

When textarea or text type input elements of the text is selected (marked), select the event will occur.

select () method triggers a select event, or when a predetermined function to run the event select event.


grammar

Trigger the selected element select events:

$(Selector) .select () try

Add function to select events:

$(Selector) .select (function) try

参数 描述
function 可选。规定当 select 事件被触发时运行的函数。


jQuery Event Methods jQuery Event Methods