I've done the following a lot in a piece of code I'm working on: var t = new Template('<div id="id_#{num}">...</div>'); $R(1,4).each(function(n){ $('page').insert(t.evaluate({num:n})); //and then I need to add some extras to that div //so I end up doing this to get a handle on it $('id_' + n ).doSomethingElse(); });
Is there another way to return a reference to a new template-based element so I don't have to do a find by ID (and worry about browsers' lag times in recognizing new DOM objects)? I can obviously just to this: var newElement = new Element('div',{id:'id_' + n}); and I have done so in a few other places, but Templates are so nice and clean and reduce the concatenation to a minimum. (Plus, this is a cut-down example and the real thing is much more complex.) It would be nice if insert could return an object reference to the object created, rather than the object that you're inserting into, or if Template could refer somehow to the object created rather than just the string that will define it once it's inserted in another element. Walter -- 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-scriptaculous@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.