[development] Using Drupal.(attach)behaviors instead of .live

arthur arthur at 24b6.net
Fri Apr 15 11:43:06 UTC 2011

You might want to look at modalframe and automodal modules. You may find some helpful bits there.

arthur at 24b6.net

On Apr 14, 2011, at 10:00 PM, Anthony Malkoun wrote:

> My understanding is that Drupal.behaviours is just like .ready.  I don't understand your distinction between ajax and js, the J in ajax stands for javascript.  But at any rate, if you're doing something on an element that doesn't exist yet, then that's what .live is for.  Just put that in your js that is in your page on the element you're expecting.  All .live really does is use event bubbling and event delegation to capture the event on a containing element.
> On 6:59 AM, jeff at ayendesigns.com wrote:
>> In the case where there will be a popup opening on a page (not sure if it will be via ajax or js yet) and I need a function to fire when the popup closes, will Drupal.behaviors <http://Drupal.behaviors> act like .live in that it will bind the function to the event at the time that the selector becomes available (read: the popup eventually exists) ?  I was thinking perhaps this is where attachbehaviors is supposed to be used, but that, I think, implies that I can alter the code that creates the popup, and I cannot...I just need to 'hook' into its close event.
>> Jeff

More information about the development mailing list