If you need to get access to the object immediately after creating it,
you may want to use the new Element() syntax instead of Template,
because this:
var foo = new Element('div',{id:'bar'});
will return a handle to the element, even before you add it to the
page, while Template.evaluate may need you to pause a beat before $
('bar') will access the element from your page after you've inserted it.
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-s...@googlegroups.com
> .
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
> .
Problem is, this is simply NOT returning!
And there is 4 lines of unrelated code between the NEW template call and the two line from my earlier message.
Sure, this is something I have struggled with as well. The return from a Template.evaluate call is not the generated object, but some other form of return (probably a boolean success or something like that -- not exactly sure).
If you need to get access to the object immediately after creating it, you may want to use the new Element() syntax instead of Template, because this:
var foo = new Element('div',{id:'bar'});
will return a handle to the element, even before you add it to the page, while Template.evaluate may need you to pause a beat before $('bar') will access the element from your page after you've inserted it.