binds multiple events. On () and unload events. Off ()
1. On () Bind event, pass different event names through space separation, you can bind multiple events at the same time, each event executes its own callback method, can pass the second object or parameter, when an event is triggered, to pass to the event handler function
2 . On () Bind 2 Events $ ("Elem"). On ("MouseDown MouseUp", fn)
3 shortcuts differ from on
On can customize event name
Multiple events bound to the same function
Multiple events bind different functions
Passing data to a handler
The 4 event is bound to the topmost div element, and when the user fires on the A element, the event will bubble up, always bubbling over the div element, and if the second argument is provided, then the event will be bubbled up to the element that is matched by the selector, triggering the event callback function
5. Off () Unload Event
6 How to Unload event off ()
event handlers that are bound by the. On ()
Remove the binding through the off () method
The 7 off method can remove the event handler function specified on the element by passing the associated event name, namespace, selector, or handler function, and only event handlers that exactly match those parameters will be removed when there are multiple filter parameters.
The 8 off method can
Delete an event $ ("Elem"). Off ("MouseDown")
Delete all Events $ ("Elem"). Off ("MouseDown MouseUp")
Shortcuts Delete all events, there is no need to pass the event name, all events bound by the node will be destroyed $ ("Elem"). Off ()
jquery Events--binding multiple events. On () and unload events. Off ()