jquery Events--binding multiple events. On () and unload events. Off ()

Source: Internet
Author: User

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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.