How the event bubbling problem raised after the on binding event in jquery solves _jquery

Source: Internet
Author: User
Tags tagname

When on bind, I bind the element to document and bind the parent element to the ancestor element, which causes return false to prevent bubbling from being invalid.

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

The on method binds events such as click on the Document object, and the click event on any element on the page bubbles to the Document object for processing.

Increased binding efficiency. When an event bubbles to the Document object, detecting the target of the event, if it matches the incoming selector (here is a button), triggers the event, otherwise it is not triggered.

Fixed to a uniform binding object, which is initially considered to be due to the binding mechanism of the on method.

So return false is not valid. After the child element and the parent element are modified to the same binding element, the problem is resolved

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

The above is described in the small set of jquery in the binding event after the event bubbling problem and the solution, hope to help everyone!

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.