Questions tagged [event-bubbling]

The concept of parent elements handling events that are propagated by a child element

In event bubbling, an event is propagated through the ancestors of the element that initially receives the event.

For example:

<div id='main' onclick='mainCode();'>
<div id='kid1' onclick='myVar=1;'></div>
<div id='kid2' onclick='myVar=2;'></div>
</div>

The click event bubbles, and so is propagated to the main <div> element after being handled by a kid <div> element.

This can make code simpler to understand, for example if mainCode() has access to the myVar variable, determining which kid sent the message is easy.

References

567 questions
13
votes
2 answers

jQuery trigger click gives "too much recursion"

I'm tryin' to make the article's link clickable on the whole article space. First, I did the hover thing, changing color on mouseover and so on... then on click it should trigger the link, but this gives a "too much recursion". I think it's…
Thomas
  • 1,444
  • 1
  • 13
  • 25
12
votes
1 answer

disable event-bubbling c# wpf

I'm having the following problem: When I got two labels into each other: And the following…
Ruben
  • 139
  • 1
  • 5
11
votes
2 answers

jQuery event bubbling on button not working as expected in Firefox

I have a
Bogdan
  • 43,166
  • 12
  • 128
  • 129
11
votes
2 answers

Ember: nested components events bubbling

I've created a set of nested components. The code is here: http://emberjs.jsbin.com/hasehija/2/edit. HTML: {{#level-1}} {{#level-2}} {{#level-3}}
andrusieczko
  • 2,824
  • 12
  • 23
11
votes
2 answers

What is the bubbling concept?

I've heard of events and SO answers "bubbling up", but what has all that got to do with bubbles?
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
10
votes
3 answers

Span inside Anchor with event bubbling

I have such a piece of html:
  • Something somethingINSIDE SPANsomething
  • To handle AJAX request when clicking on anchor I have registered handler on click event: $('.addToFriends…
    dragonfly
    • 17,407
    • 30
    • 110
    • 219
    10
    votes
    1 answer

    Bubbling and capturing with addEventListener

    I recently discovered the difference between Bubbling and Capturing on DOM events, using javascript. Now I understand how it's supposed to work, but I've found a weird situation and I would like to know why is that happening. According to Quirks…
    10
    votes
    3 answers

    Event Bubbling, and Stop Propagation

    What is the difference between event.bubbles to false for any event, and setting event.stopPropagation() or stopImmediatePropagation() while handling event? I'm using Flex4 with AS3.
    10
    votes
    2 answers

    Stop Event bubbling for a disabled element

    I have a button that has a style pointer-events: none; And this button has a parent element that performs a collapsible event. I don't know how to prevent this button from triggering its parent elements collapsible event. This is caused because of…
    rajkumarts
    • 399
    • 1
    • 7
    • 20
    10
    votes
    3 answers

    Prevent scroll bubbling

    How can I prevent scroll bubbling? The following example isn't work: Scroll Bubbling