8
5
|
I want to understand how exactly to interpret bubbling. Does it mean going up the HTML code hierarchy or something else?
Secondly, I was going through an example and I could not understand the last part where it says
What does this mean?
| ||||
|
4
|
will prevent "bubbling". It's used to stop default actions like checking a checkbox, opening a select, a click, etc.
Reasoning (thanks to @AlienWebguy):
The reason
stopPropagation() doesn't work with live() is that live() binds the event to document so by the time it fires there's no where else for it to propagate. | ||||||||||||||||||||
|
16
|
The concept of "bubbling up" is like if you have a child element with a click event and you don't want it to trigger the click event of the parent. You could use
event.stopPropagation() .event.stopPropagation() basically says only apply this click event to THIS CHILD NODE and don't tell the parent containers anything because I don't want them to react.
Event Capturing:
Event Bubbling:
If you are using
live() or delegate() you will need to return false; , though it may not work. Read the quote below.
Per JQuery docs:
In the past it was a platform issue, Internet Explorer had a bubbling model, and Netscape was more about capturing (yet supported both).
The W3C model calls for you be able to choose which one you want.
I think bubbling is more popular because, as stated there are some platforms that only support bubbling...and it sort of makes sense as a "default" mode.
Which one you choose is largely a product of what you are doing and what makes sense to you.
Another great resource: http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/
| ||||||||||||||||
|