English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery triggerHandler() method

jQuery Events

The triggerHandler() method triggers all events attached to the matching elements of the given event type...

To trigger an event handler by triggering the default behavior of the event, you can usetrigger()Method.

Syntax:

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

Example

Trigger the select event of the <input> field:

$("button").click(function(){
  $("input").triggerHandler("select");
});
Test and see‹/›

Show the difference between the trigger() method and the triggerHandler() method:

$("#btn1").click(function(){
  $("input").trigger("select");
});
$("#btn2").click(function(){
  $("input").triggerHandler("select");
});
Test and see‹/›

Parameter Value

ParameterDescription
eventA string containing JavaScript event types, such as click or Submit
param1,param2,...(Optional) Other parameters passed to the event handler

jQuery Events