2009/4/29 Stucture_Ulf <[email protected]>:
>
> I'm using event.observe to handle event handling and my aim is to have
> these in separate .js files and initiated through the dom:onload
> function when the pages is loaded instead of onclicks in the html
> markup.
>
> I'm initializing additional event.observes by using oncomplete to
> attach new event.observes when the ajax.request is called/done( when
> loading separate pages dynamically into the page/dom). I find this
> method a bit difficult to overview. It feels like I've missed some
> basic function/method on how to dynamically add event.observe when
> loading additional pages. Are there any other, more efficient and
> simpler ways to control, build the event handling? Any hints
> appreciated.
> >
>
Rather than observing events on the newly loaded elements, why not
observe them on the static container and allow the events to bubble
up.

That way, you attach as soon as you can and any content change
performed by AJAX doesn't have the problems of having events attached
when the elements are removed/updated.

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to