Bind event addeventlistener

Source: Internet
Author: User
 

The addeventlistener () method is used to add an event handle to a specified element.

The event handle added by the addeventlistener () method does not overwrite the existing event handle.

You can add multiple event handles to an element.

You can add multiple event handles of the same type to the same element, for example, two "click" events.

You can add event listening to any DOM object, not just HTML elements. For example, the window object.

The addeventlistener () method can more easily control events (bubble and capture ).

When you use the addeventlistener () method, JavaScript is separated from the HTML tag, which is more readable. You can also add event listening when HTML tags are not controlled.

You can use the removeeventlistener () method to remove event listening.

<! Doctype HTML> 

 

Bind event addeventlistener

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.