Starting from jQuery 1.3, events triggered by the trigger() function also support event bubbling, which can be bubbled and passed to the DOM tree.
This function belongs to the jQuery object (instance).
Syntax
The trigger() function mainly has the following two forms of usage:
Usage 1:
jQueryObject.trigger( events [, extraArguments ] )
Trigger events of the specified type (events) on each matching element, and can pass in additional parameters (extraArguments) to the event handling function.
Usage 2: jQuery 1.3 newly supports this usage.
jQueryObject.trigger( eventObject [, extraArguments ] )
is the Event object (eventObject) passed in by the specified event processing function, which is used to trigger the execution of the corresponding event processing function and can be used for events The processing function passes in extra parameters (extraArguments).
Parameters
Parameter Description
extraArguments Optional/Object type is the extra parameters passed in by the event processing function. If you want to pass in multiple parameters, please pass them in as an array.
eventObject Object type is an Event object, used to trigger the event processing function passed in to the object.
Thetrigger() function will pass in a default parameter for the event processing function that triggers execution, which is the Event object representing the current event.
The parameter extraArguments is used to pass in more additional parameters to the event handling function. If extraArguments is in array form, each element will serve as a parameterto thefunction.