As each element is triggered in the document, it will bubble
If there are alert events on each layer, then the inner div is triggered, the outer layer, the outermost layer.
To prevent interference between events, you need to block event bubbling.
General use of e.stoppropagation ();
IE8 and below do not support, need to use e.cancelbubble=false;
Another e is the global object used to get the window. E can use any other letter or Word instead, such as a,b,c,d....,event,obj and so on.
Whenever an event is triggered, the system will pass an object to the event to obtain a global object.
For example, through E to get global object Stoppropagation (), Cancelbubble,pagex,pagey, which can be seen through the page Console.info ().
E.stoppropagation (), also equivalent to return false;
Just return false there are other actions that prevent the default behavior of the event, such as the default jump href for the submit button submit,a tag, and so on.
return false; equal to E.preventdefault ();
E.preventdefault () cannot prevent the event from bubbling, only the triggering of the event's default behavior is blocked.
Return false contains two features that block event bubbling and block the default behavior.
Therefore, in development, it is customary to use return false.
JS Block event bubbling return false/e.stoppropagation ()/e.preventdefault ()