What is JS event bubbling?
Trigger a certain type of event on an object (such as clicking an onclick event). If this object defines the event handler, this event will call this handler, if the
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
Event bubbling in jQuery and jQuery event bubbling1. What is bubbling?
Eg:
When you click 'inner span element', that is, when the
That is:
The inner span element is clicked.
The outer div element is clicked.
Body element clicked
This is caused by event
Reprint please indicate source: http://www.cnblogs.com/zhangmingze/p/4864367.html event is divided into three stages: event capture---event target---event bubbling event capture: When an event
target element with a dependency to the most indeterminate target element. Bubbling technology. The basic idea of bubbling events, Events are based on the target of the most uncertain event, starting from a specific event target.Capture-type events (event
Trigger a certain type of event on an object (such as clicking an onclick event). If this object defines the event handler, this event will call this handler, if the event handler is not defined or the event returns true, the
Early events, as a means of sharing server computing load, are specific interactions that occur in real documents or browser windows, such as click Buttons, drag and drop files, and so on. We can use listeners to schedule events and respond when an event is released, a pattern called the Observer model.
Event FlowThe event flow is the order in which events are re
Although proficient in jquery, but not very familiar with its prototype JavaScript, recently encountered some difficulties in learning JavaScript, such as bubbling and capturing, many times mentioned, but do not know exactly where to apply. Find some good articles for your doubts, and share them here.I. Order of occurrence of eventsThe origin of this problem is very simple, assuming you have another element
Stop event bubblingfunction Stopbubble (e) { //If an event object is provided, this is a non-ie browser if (e e.stoppropagation) { // So it supports the Stoppropagation () method e.stoppropagation (); } else { //Otherwise, we need to use IE to cancel event bubbling Window.event.c
div id="outer"> p id="inner">Click me!p>div>Event bubblingMicrosoft has proposed an event stream called event bubbling. Time bubbling means that events start from the most inner element and propagate upward until the document object.So the above example takes place under
Events-how to use events and what are the main differences between the IE and DOM event models, a friend you need to refer to(1) Bubbling event: The event is triggered in the order from the most specific event target to the least specific
") alert ("outer _ bubble");} function m_click_ B () {console. log ("middle _ bubble") alert ("middle _ bubble");} function I _click_ B () {console. log ("inner _ bubble") alert ("inner _ bubble");} script
When we click inner, the result is:
Outer _ capture
Middle _ capture
Inner _ capture
Inner _ bubble
Middle _ bubble
Outer _ bubble
It can be seen that the event is captured first from the external event
(1) Bubbling event: The event is triggered in the order from the most specific event target to the least specific event target (Document object).IE 5.5:div, Body, documentHTML--Document, body, IE 6.0:divMozilla 1.0:div, body, HTML, document, window(2) Capture
1) Bubbling event: The event is triggered in the order from the most specific event target to the least specific event target (Document object).IE 5.5:div, Body, documentHTML--Document, body, IE 6.0:divMozilla 1.0:div, body, HTML, document, window(2) Capture
Javascript prevents event bubbling and default browser behavior, javascript bubbling
1. Prevent event bubbling and make it a capturing event trigger mechanism.
Function stopBubble (e) {
Event bubbles. Blocking event bubbling | blocking the default behavior of elements and bubbling events
If multiple elements overlap in the page and these elements are bound to the same eventCurrent bubble problem.
The trigger sequence is from small to large.This is the so-called bubble phenomenon, layer by layer.
executing the same event.Btn1.addeventlistener (' click ',function(e) {//true for event capture, false for event bubbling //false is the default, bubbling mode is performed //When you click Btn1, the Click event on the BTN1 is executed first, and then the Clic
(1) Bubbling event: The event is triggered in the order from the most specific event target to the least specific event target (Document object).
IE 5.5:div-> Body-> Document
IE 6.0:div-> body-> HTML-> document
Mozilla 1.0:div-> body-> HTML-> Document-> window
(2) Captur
One:DOM event Flow :The event flow is the order in which events are received from the page, and the DOM2 level event specifies that the event flow consists of three stages:① Event Capture phase: An event flow model that is intende
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.