$$('css selector for elements').invoke('observe', 'click', function(e) { for
click });
or if you need to assign different handlers you have a few options such as
each with type checks followed by an observe call..http://www.prototypejs.org/api/utility#method-$$ http://www.prototypejs.org/api/enumerable/invoke If your clickable elements have a common parent, it is more efficent to observe the click event on the parent and allow bubbling to keep your resources down. Gareth Evans On Dec 5, 2007 3:01 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Simple question: I need to add an onchange handler to multiple > elements (say, 50 of them). Any suggestions on the most elegant > solution to this using Prototype? > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
