One, on () multi-event binding
$ ("#elem"). On ("MouseOver mouseout", function () {}); Multiple events bind a function
$ ("#elem"). On ({ //multiple event bindings for different functions mouseover:function () {}, mouseout:function () {}});
<div class= "Left" > <p class= "Aaron" > <a> Target node </a>//Click on this element </p></ Div>
$ ("div"). On ("click", "P", FN)
Events are bound to the topmost div element, and when the user fires on the A element, the event will bubble up and will always bubble on the div element.
If a second parameter is provided, the event callback function is triggered when the events encounter a selector-matched element p in the bubbling process.
Second, unload event off () method
- Event handlers that are bound by the. On ()
- Remove the binding through the off () method
Depending on the characteristics of the on binding event, the off method can also remove the event handler specified on the element by passing the corresponding combination of event name, namespace, selector, or handler function.
When there are multiple filter parameters, only event handlers that exactly match those parameters will be removed
$ ("BTN"). Click (function () { $ (". Aaron:first"). Off (' MouseDown ');//Remove mouse down event})
jquery events-Bindings and unbinding