On Jan 30, 2008 6:57 PM, kaydub <[EMAIL PROTECTED]> wrote:
> $('element1','element2').onchange =
> this.EventHandlerFunction.bindAsEventListener(this);

When you pass multiple element ID's, you get an array of elements
instead of an individual element. Since you want to attach the event
listener to each object, you need to iterate on the array and attach
the listener to each individual element.

$('element1', 'element2').each(function(element){
  element.observe('change', this.changeHandler.bindAsEventListener(this));
}.bind(this));

You *could* use invoke instead to turn this into a one-line operation,
but I think the above code example more clearly shows what's going on.

-justin

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to