Hi speedpacket, > Is there a way to observe the dom and automatically run newly created > elements through the initialise function?
could you please explain a little more what is expected ! Or perhaps if you have some available code ? -- david On 4 déc, 13:19, "speedpac...@gmail.com" <speedpac...@gmail.com> wrote: > Hello there, > > I have another question that I hope someone can give me some insight > too... > As I want all javascript code to be in a seperate file, I wrote a > function "initialiseElements" which literally takes an element and > initialises its behaviour based upon some attributes (classname for > instance). > > Basically it takes the elemen, checks whether el.readAttribute > ("isInitialised") == false, and in that case processes the element > (adding tooltips for action images, adding onclick behaviour, > onmouseover behaviour, add validators to inputs and so on...) > When processed we set el.writeAttribute("isInitialised") = true so > that it will only process one element a single time... > > I found this way of working to be going great, and I basically call > the initialiseElement method for each element upon loading the form, > making it a very generic process... > > However (yes, there is a but!!!), I do have an issue of course when I > cal some ajax to update the content; in that case I need to initialise > the elements that have been added... > > Is there a way to observe the dom and automatically run newly created > elements through the initialise function? > > Would this be a good approach? > How do you guys deal with stuff like this? > > thanks so much in advance again for your much appreciated feedback. -- 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 prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.