[thelist] Tip: Using event delegation for more flexible web apps

Christian Heilmann codepo8 at gmail.com
Mon Sep 25 11:24:28 CDT 2006

<tip type="javascript" author="chris heilmann">
In order to cut down on the amount of event handling in applications
you can simply assign one event handler on a parent element and
retrieve the element that was activated via a getTarget() method. This
is possible because elements report event activity to their parent
nodes (event bubbling). This trick is called event delegation:

This got stuck somehow, sorry if you get that twice...
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/

More information about the thelist mailing list