On Oct 29, 4:58 am, Robert Zotter <[EMAIL PROTECTED]> wrote:
> kimbaudi,
>
> Like you said, $$() returns and array of DOM elements. You just need
> to iterate over the collection and set up the observe event on each
> item. For example:
>
> $$('.class').each(function(element) {
> element.observe('click', function() {
> alert('clicked');
> });
>
> });
>
Or slightly more compactly
$$('class').invoke('observe', 'click', function() {alert('clicked')});
This would be a good time to use a named function rather than an
anonymous one, unless you actually need a separate instantiation of
the function for each element.
Colin
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---