what is event bubbling? How does event bubbles up? In this post, I'll explain how event bubbling happens and how to achieve event bubbling with JavaScript and jQuery using event delegation.
event bubbling in Javascript explained.
seen from Peru

seen from United Kingdom

seen from China

seen from United States
seen from United States
seen from China

seen from United States
seen from United States
seen from China
seen from South Africa

seen from Maldives
seen from United States

seen from Brazil

seen from United States
seen from Ireland
seen from United States
seen from United States

seen from United States
seen from United States
seen from United States
what is event bubbling? How does event bubbles up? In this post, I'll explain how event bubbling happens and how to achieve event bubbling with JavaScript and jQuery using event delegation.
event bubbling in Javascript explained.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Event Bubbling
No, this does not involve a glass item and a plant named "OG". This is how browsers handle events, most commonly clicks, when nested in parent elements.
Here's an example:
var e1 = document.getElementById("e1"); var e2 = document.getElementById("e2");
// TRUE = TOP => DOWN (CAPTURING) // FALSE = DOWN => UP (BUBBLING) e1.addEventListener('click', doSomething1, false); e2.addEventListener('click', doSomething2, false);
function doSomething1() { Â Â Â console.log(this.id); }
function doSomething2(e) { Â Â Â alert(this.id); Â Â Â e.stopPropagation(); }
The stopPropagation function prevents bubbling from happening up the hierarchy. Conversely, changing the event listener on e1 from "false" to "true", would trigger a top-down approach, bypassing e.stopPropagation() altogether!
Potent stuff.