jQuery Event - trigger() Method
Example
Trigger the select event of the input element:
$("button").click(function(){ $("input").trigger("select"); });
Definition and Usage
The trigger() method triggers the specified event type on the selected element.
Trigger Event
Specifies the event to be triggered on the selected element.
Syntax
$().trigger(event,param1,param2,...])
Parameter | Description |
---|---|
event |
Required. Specifies the event to be triggered on the specified element. Can be a custom event (attached using the bind() function) or any standard event. |
[param1,param2,...] |
Optional. Additional parameters passed to the event handler. Additional parameters are particularly useful for custom events. |
Triggering Events Using Event Object
Specifies the event to be triggered on the selected element using the event object.
Syntax
$().trigger(eventObj)
Parameter | Description |
---|---|
eventObj | Required. Specifies the function to be executed when an event occurs. |