Example
Trigger the select event of an input element:
$("button").click(function(){ $("input").trigger("select"); }); |
Try it yourself »
|
Definition and Usage
The trigger() method triggers specified event types for selected elements.
Trigger an Event
Specifies an event to trigger for the selected elements.
Syntax
Parameter |
Description |
event |
Required. Specifies the event to trigger for the specified
element.
Can be a custom event (attached using the bind() function), or
any of the standard events
|
[param1,param2,...] |
Optional. Additional parameters to pass on to
the event handler.
Additional parameters are especially useful with custom events |
Trigger an Event Using an Event Object
Specifies an event to trigger for the selected elements using an event object.
Syntax
Parameter |
Description |
function |
Required. Specifies the function to run when the blur event occurs |