In the front-end development work, because of browser compatibility issues, we often use "stop event bubbling" and "block browser default behavior."
1. Block Browser default behavior
function Stopdefault (e) {
//If an event object is provided, this is a non-ie browser if
(e e.preventdefault) {
//block default browser action (web)
E.preventdefault ();
What is the JS event bubbling? Network(2012-06-19 22:02:23)
Tags: gossip
What is the JS event bubbling? :Fires a class of events on an object (such as clicking the OnClick event), and if this object defines a handler for this
One, what is event bubblingEvents are some kind of state or behavior used to trigger JS code, which is the bridge between HTML implementation and JS interaction. An event must be installed on an object, such as an element in a browser or document, or an event cannot exist. Imagine that if you do not bind an event such
What is the JS event bubbling? :Fires a class of events on an object (such as clicking the OnClick event), and if this object defines a handler for this event, then this event invokes the handler, and if the event handler is not d
What is the JS event bubbling? :Fires a class of events on an object (such as clicking the OnClick event), and if this object defines a handler for this event, then this event invokes the handler, and if the event handler is not d
What is the JS event bubbling? :Fires a class of events on an object (such as clicking the OnClick event), and if this object defines a handler for this event, then this event invokes the handler, and if the event handler is not d
1. What is bubbling
eg
3 records are output when you click the ' inner span element ', that is, when the click event of the
That
The inner span element is clicked
The outer div element is clicked
The BODY element is clicked
This is caused by event bubbling.
2.
What is the JS event bubbling? :Fires a class of events on an object (such as clicking the OnClick event), and if this object defines a handler for this event, then this event invokes the handler, and if the event handler is not d
Yesterday, an interviewer asked me questions, he asked me directly two div nested, all have the click event, click to pop the child div or the parent div. I don't know why.After the inquiry after the information, it is very ashamed. It turns out that he was asking about JS capture and bubbling.I have queried some information:Event Capture (Parent-"son")When you use event capture, the parent element is trigg
1. Event Bubbling: Event bubbling is from the inside out, it is bubbling up along the DOM level, directly to the top, and the HTML element can accept the bubbling event. 2.
What is JS event bubbling?
Triggers a class of events (such as clicking the OnClick event) on an object. If this object defines a handler for this event, this event invokes the handler, and if no such event handler is defined or
Condition: the outer layer has a DIV element and the inner layer has a P element. The relationship exists as follows: DIV is the parent element of the P element, while P is the child element of the outer DIV, there is a relationship between the two. Condition: the outer layer has a DIV element and the inner layer has a P element. The relationship exists as follows: DIV is the parent element of the P element, while P is the child element of the outer DIV, there is a relationship between the two.
What is bubbling:Simply put is the event that triggers a child container, and the event of the parent container is then triggered.The alert (' child ') and alert (' parent ') events are added to child and parent respectively, and if we click on Child, we will first execute alert (' child ') and then the parent element's alert (' Parent ') will also be executed, of course, if there are more levels, the paren
If an element defines event A, such as the Click event, if a bubbling event is not blocked after the event is triggered, the event propagates to the parent element The JS bubbling mec
One: event bubbling means: A large container has been set up the event, if the container also contains a small container also set its own events, then because the small container is inside the large container, triggering the event of a small container is also equal to triggering the
What is event bubbling?
Event bubbling is an event handler that automatically calls its parent element in the child element's event handler when the parent and child elements have the same
You can have multiple events on a page, or multiple elements that respond to the same thing,Issues caused by event bubbling:Events that you don't want to use at some point, but are triggered by events bubblingSolve the problem:1. Event ObjectBecause Ie-dom and standard DOM implementations of event objects are different, it becomes difficult to get
What is the JS event bubbling? :Fires a class of events on an object (such as clicking the OnClick event), and if this object defines a handler for this event, then this event invokes the handler, and if the event handler is not d
Implementation of the tap event in zepto. js to prevent bubbling
This article mainly introduces the implementation method of the tap event in zepto. js to prevent bubbling. The example analyzes the solution to the click latency caused by bubbling. For more information, see
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.