Monday, October 6, 2008

jQuery - Creating Modal Dialogs

I am still working my way through the jQuery in Action book and I still need to write a review on it...soon....
Well, this weekend I was checking out several jQuery plugins - In my home project I needed to replace a few old-school/legacy JavaScript confirmation boxes with something more stylish looking. While jQuery by itself is very nice, its plugin mechanism and consequently its plugin repository is simply impressive. There is almost too much choice ;-) Anyway, there were several plugins for creating modal dialogs. I finally settled on SimpleModal - So far it worked quite well and the documentation is helpful, too.

The next plugin I have to look at is Live Query. I use a few Ajax driven data grids that return DOM nodes to which I would like to attach events. Live Query watches out for those node changes and applies some magic to make it work.


Unknown said...


Please dont use Livequery, it is very performance heavy (scans the dom every 20ms looking for changes). Use event delegation instead. E.g most events bubble through the parent hierarchy so add the event to an ever present node (table/body etc) and then check the target of the event. There are a few delegate plugins available. PS this will be introduced into the core at the next release. Click
for more info

Gunnar Hillert said...

Thanks for your comment. Hadn't seen anything on the performance impact of Livequery - thanks for pointing it out. I read the posting of Dan Webb's - very interesting. Especially I liked this article he referred to in his post.