Even better. Very easy to read.
Thanks to both of you and Prototype Developers for making that
functionality kick soo much arse ..
Here I was thinking it wasnt gonna happen.. Last time I think that..
On Jan 31, 11:29 am, Tobie Langel <[EMAIL PROTECTED]> wrote:
> oops!
>
> $('element1','element2').invoke('observe', 'change',
> this.EventHandlerFunction.bind(this));
>
> cf.:http://prototypejs.org/api/enumerable/invokehttp://prototypejs.org/api/element/observe
>
> On Jan 31, 2:24 am, Tobie Langel <[EMAIL PROTECTED]> wrote:
>
> > $('element1','element2').each(function(e) {
> > e.onchange = this.EventHandlerFunction.bind(this);
>
> > }.bind(this));
>
> > However, I'd strongly advise using Event.observe instead like so:
>
> > $('element1','element2').invoke('change',
> > this.EventHandlerFunction.bind(this));
>
> > Best,
>
> > Tobie
>
> > On Jan 31, 1:57 am, kaydub <[EMAIL PROTECTED]> wrote:
>
> > > Greetings;
>
> > > Inside the init() for my class I am assigning event handlers and want
> > > to use the same handler function for 2 separate elements so I am using
> > > the following code:
>
> > > $('element1','element2').onchange =
> > > this.EventHandlerFunction.bindAsEventListener(this);
>
> > > I assumed since I can chain elements inside the $() function that the
> > > functionality would allow for this. It doesnt.
>
> > > It doesn't catch the event for either element at all.
>
> > > When I seperate the code into 2 lines and assign the function to each
> > > element independently it works fine:
>
> > > $('element1').onchange =
> > > this.EventHandlerFunction.bindAsEventListener(this);
> > > $('element2').onchange =
> > > this.EventHandlerFunction.bindAsEventListener(this);
>
> > > I dont have a problem with doing that but I would much prefer to use
> > > the former to remain consistent with $().
>
> > > I havent looked much into the source to find where it is stopping but
> > > is this a bug?? Should I report it?
>
> > > Thanks ahead of time,
> > > Kev
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---