Re: [jQuery] Best practices for reattaching behaviours todynamically loaded content?

2007-03-09 Thread Nedjo Rogers
You could pass the changed element as additional arguments to the event, so you just update those, something like this: // jquery.myPlugin.js $(window).bind('myPluginReload', function(event, changedElement) { $(find stuff, changedElement).myPlugin({do: things}); }); // Content being

Re: [jQuery] Best practices for reattaching behaviours todynamically loaded content?

2007-03-07 Thread Jonathan Chaffer
Hey, Nedjo. Good to see you on this side of the Drupal/jQuery fence. :-) I like Felix's suggestion in this case. In the near future there will be a dead-tree reference for jQuery on the shelves. A short excerpt from the first draft should prove applicable to this conversation:

Re: [jQuery] Best practices for reattaching behaviours todynamically loaded content?

2007-03-07 Thread Chris Domigan
Another solution that I've found really handy is to have your event code included with the html. So, as in my first example, I might have a php class that generates a datagrid - both the html AND the javascript with event handlers etc. So the handlers are bound on initial page load, and then

Re: [jQuery] Best practices for reattaching behaviours todynamically loaded content?

2007-03-07 Thread Jonathan Sharp
Here's another thought too... What about having a plugin export a custom event, then when dynamic content is loaded that uses that plugin it just triggers that event. For example: // jquery.myPlugin.js $(window).bind('myPluginReload', function() { $(find stuff).myPlugin({do: things}); });

Re: [jQuery] Best practices for reattaching behaviours todynamically loaded content?

2007-03-07 Thread Jörn Zaefferer
Jonathan Sharp schrieb: Here's another thought too... What about having a plugin export a custom event, then when dynamic content is loaded that uses that plugin it just triggers that event. For example: // jquery.myPlugin.js $(window).bind('myPluginReload', function() {