Latest web development tutorials

jQuery triggerHandler () method

jQuery Event Methods jQuery Event Methods

Examples

Trigger <input> element select events:

$("button").click(function(){
$("input").triggerHandler("select");
});

try it"

Definition and Usage

triggerHandler () method triggers the specified event on the selected element.

The method and trigger () similar method, except that the trigger () also triggers the default behavior of an event (such as form submission).


grammar

$(selector).triggerHandler(event,param1,param2,...)

参数 描述
event 必需。规定指定元素上要触发的事件。
param1,param2,... 可选。传递到事件处理程序的额外参数。
额外参数对自定义事件特别有用。


Examples

More examples

Pass additional parameters to a custom event
How to pass additional parameters to a custom event handler.

Different trigger () and triggerHandler () between
Different Demo trigger () and triggerHandler () between.


jQuery Event Methods jQuery Event Methods