Geeks With Blogs
Asif Maniar Software Engineer

Recently I had to code some functionality that required event delegation in JavaScript.
After searching I came across this great post by Karl Swedberg about how events can be delegated using jQuery.
This can be a very useful approach if you want to add new elements to the DOM and have them react to events without re-binding events handlers or if your page simply has too many elements that need to be wired to an event.

The basic concept it simple: Instead of attaching an event to an individual element attach it to the parent and then get the target of the event when it is raised.

Read the complete post here:

In his next article Karl looked at re-binding event handlers instead of delegation.

Posted on Monday, October 5, 2009 2:59 PM jQuery | Back to top

Comments on this post: jQuery Event Delegation

comments powered by Disqus

Copyright © Asif Maniar | Powered by: