What is the JS event bubbling?
How do I prevent jquery events from bubbling?  
<! DOCTYPE html>
such as the above page,
divided into three layers: Divone is the outer layer, divtwo middle layer, hr_three is the innermost layer;
they all have their own click events, and the innermost a tag has an href attribute.
run the page, click "Click Me", will pop up: I am the innermost----> I am the middle tier----> I am the outermost----> and then link to Baidu.
This is the event bubbling, originally I only clicked the tag with ID Hr_three, but did perform three alert operations.
event bubbling process (denoted by tag ID): hr_three---->divtwo---->divone. Bubbles from the innermost layers to the outermost layer.
How to stop it?
1.event.stoppropagation ();
<script> $ (function () {$ ("#hr_three"). Click (Function (event) {event.stoppropagation (); }); }); <script>
then click "Click Me", will pop up: I am the innermost layer, and then link to Baidu
2.returnfalse;
If the header is joined by the following code
<script "> $ (Function () {$ (" #hr_three "). Click (Function (event) {return false; }); }); <script>
then click on "Click Me" will pop up: I am the innermost, but will not execute link to Baidu page
This can be seen:
1.event.stoppropagation ();
Event bubbling is blocked during event processing, but does not halt the default behavior (it performs a hyperlink jump)
2.returnfalse;
Event bubbling is blocked during event processing, and the default behavior is also blocked (for example, a jump that did not perform a hyperlink just now)
There is also a bubbling-related:
3.event.preventdefault ();
If you put it in the Click event of the head a tag, click "Click Me".
will find it pop up in turn: I am the innermost----> I am the middle tier----> I am the outermost, but finally did not jump to Baidu
its role is: During event processing, do not halt the event bubbling, but the default behavior (it only executes all the bullets, but did not perform a hyperlink jump)
Introduction to jquery event bubbling and how to prevent events from bubbling