Hi,

Luca Guidi wrote:
> DollarDollar returns a collection of matched elements, so the best way is:
> $$('.extrainfo').each(function(element){
>    Event.observe(element, 'change', myfuntction(id))
> });
> 


Top of my head and not tested,
you could also use #invoke, which is simpler:


$$('.extrainfo').invoke('observe', 'change', myfunction);


Notice that you should not execute myfunction(),  but pass reference 
to it to #observe method (unless myfunction(id) returns reference to a 
function).

myfunction will be called with event as first parameter, so you will 
have to check Event.findElement() to check which <select> was changed,
e.g:

function myfunction(evnt) {
   //should alert id of changed  <select>
   alert (Event.findElement(evnt).id);
}

See Enumerable#invoke docs for details.

-- 
Regards,
SWilk

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-spinoffs@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to