PDA

View Full Version : Events passed in the DOM tree?



phoenixshade
Mar 3rd, 2007, 06:10 PM
Just a quick generic question. Are events in javascript supposed to pass back up the DOM heirarchy to their parents? For example, in this structure:

<div>
<ul>
<li>
<a>link</a>
</li>
<li>
<a>link</a>
</li>
</ul>
</div>
Would a the <div> receive an onClick event if one of the links is clicked?

Thanks.

chump2877
Mar 3rd, 2007, 06:31 PM
If the div also had an onclick event handler, it would....it's called event bubbling (http://www.quirksmode.org/js/events_order.html)....

phoenixshade
Mar 3rd, 2007, 06:52 PM
Thanks for the quick answer and the link.