Before the incident bubbling problem, also went to the internet to search for some, the results are mostly the same code, posted to the time is not very smooth. When it comes to FF, you can use E.stoppropagation (); , somehow I didn't succeed. However, I find that FF supports e.cancelbubble = True, and is tested and feasible. Just post the code here, and the province can look everywhere. The compatibility of previous versions of IE has not been tested
This #btncomfirmchoosecompany is a button on the bootstrap modal layer, but after clicking, the Click event is bootstrap the outer monitor hears, the effect is the modal popup layer is closed, so I do not want this click event is "passed" to the "outer" page.Please note that the parameter E is missing from the beginning and the effect of the code does not meet my expectations.$ ("#btnComfirmChooseCompany").
/*---------------------------Function: Stop event bubbling---------------------------*/function Stopbubble (e){If an event object is provided, this is a non-IE browserif (e e.stoppropagation)So it supports the Stoppropagation () methodE.stoppropagation ();ElseOtherwise, we need to use IE to cancel the event bubblingWi
register multiple event listeners for the same event? Originally, the attachEvent () method was introduced to support this feature from the IE5.0 series. Unfortunately, this method does not support event capture. This method has been discarded since IE 11.
Event capture and bubbl
. First, we have to block bubbling. Otherwise, clicking the button actually triggers the above two events, modal cannot be displayed, but it is actually popped up and hidden immediately. Besides, when we have many widgets in the modal box, it is difficult to judge the clicks in the modal box.
Here, I think there is one of the most classic methods, which is simple but clever,
First, listen to an event for
When js is used to specify a style or bind an event to an Html element, it is easy to bind the style or event to the parent element of the target element because the browser event is captured/bubbling, if you only want to bind a style or event to a specified target element,
I learned an event bubbling mechanism today and thought it was a bit problematic. I tested it myself and shared the results with you, which helps you better understand the event bubbling mechanism.
For example:
After you click "hello", f1 will pop up, and f2 f3 will pop up. Then, when the sub-tag generat
Here is just a simple code demo, because the time problem does not do in-depth research, because today when doing the project to block the event bubbling content, find a lot to find a can use, special records.
The above is the entire contents of this article, I hope you can enjoy.
Scroll cannot be captured in the IE8-9, and cannot be used as event proxy because it cannot be bubbling. It can be handled by capture under ff.
The focus and blur events can be simulated by focusin and focusout events in IE. However, for general elements that cannot be non-form elements, links, images, and other elements, we need to set tabindex for the focus and blur events, in order to make it have the
The solution for stopping event bubbling already exists in various browsers, but it is insufficient for mouseover and mouseout. There are onmouseleave and onmouseenter in IE, which is a headache for Web developers who want to be compatible with various browsers.
Although there are some plans for Mozilla Firefox on the Internet, the amount of code is not optimistic.
I tried to find a better solution, so I
This article is from the "Empty" blog, make sure to keep this source http://6738767.blog.51cto.com/6728767/1583076JavaScript example six (event bubbling and capturing)
We all know that there are two mechanisms for jQuery event triggering, one is event delegation, and the other is event bubbling, bubbling, or default events, which are not required in some cases, here, we need some methods to prevent bub
1. Event.preventdefault (); --The default event that blocks the element.Note: A element of the click-Jump default event,
Default event for form elements such as Button,radio,
div element has no default event
Cases:
Copy Code code as follows:
Copy Code code as follows:
var samp =
node. Due to event bubbling, the DOM node event is also triggered and the callback function is executed, which violates the original intention.How to prevent javascript event bubbling
1. cancelBubble (html dom
Binding Event Sequence in JS (difference between event bubbling and event capturing) and js bubbling
In JS, the default execution time of bound events is in the bubble stage, rather than in the capture stage (important). This is why when the parent class and subclass are bou
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.