Thanks Robert On Tue, Oct 28, 2008 at 9:58 PM, 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'); > }); > }); > > Cheers > > -- > Robert Zotter > Zapient, LLC > Ruby on Rails Development and Consulting > > http://www.zapient.com > http://www.fromjavatoruby.com > > On Oct 28, 9:27 pm, kimbaudi <[EMAIL PROTECTED]> wrote: > > Hi, I am having trouble with using Element.observe() with $$(). If I > > have an element with id="id", I can do this: > > > > $('id').observe('click', function() {alert('clicked');}); > > > > However, if I have elements with class="class", I can't do this: > > > > $$('.class').observe('click', function() {alert('clicked');}); > > > > I know that $$() returns a document-order array of extended DOM > > elements, but I have no idea how to use Element.observe() on the array > > returned by $$(). Any help will be greatly appreciated. > > > > - Paul > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---