jQuery Delegate plugin – cross-browser submit/reset event delegation
April 27th, 2008
- Category:
- JavaScript,
- Web Development,
- jQuery
Dan Webb has written an event delegation plugin the other day (as part of Low Pro for jQuery) – I really like his solution and as soon as you are working with Ajax page updates a lot you got to love the ease the event delegation technique provides.
There is one major drawback though. In IE submit and reset events do not bubble, thus you cannot use delegation here. Same is true for submit events in Safari 2.
In the upcoming Plazes delegation for submit/reset events turned out to be a requirement, so I wrote an event delegation plugin based on Dan Webb’s stuff, in particular on what Yehuda Katz proposed in one of the comments, and added workarounds for IE and Safari, so that you can now use delegation for these events just as you would expect. There were also some issues with using confirm().
I needed to do that quickly, thus the code could use some optimization (later).
Get it here:
http://stilbuero.de/jquery/delegate/
I just noticed that Jörn Zaefferer wrote something similar for the focus and blur events and I’m going to merge the two.
4 Comments
Comments feed
Comment by Nathan Bubna, June 27th, 2008 at 6:17 pm
Comment by Jeremy, August 25th, 2008 at 7:19 pm
Author Comment
Comment by Klaus, August 26th, 2008 at 11:00 am
Pingback by Marcyes / Event Delegation using jQuery, March 3rd, 2009 at 12:38 am