Greetings, You could also use the "bindAsEventListener" property of the function to return a function closure that will guarantee that an event object is sent as the first parameter in the call back. Once in the call back you can retrieve your event's target object via the Event.element function.
You can leverage bind and bindAsEventListener in many ways to attach parameters to the call back such that when it is executed you have the parameters that were attached upon its "binding" in the argument scope. Here is an article more about that idea http://positionabsolute.net/blog/2007/04/function-bind.php On Jun 15, 8:40 am, kangax <[EMAIL PROTECTED]> wrote: > This should do it: > > moveLinks.each(function(el){ > el.observe('click', function(e){ > alert(Event.element(e).getAttribute('id')); > Event.stop(e); > })}) > > -- > View this message in > context:http://www.nabble.com/Event-Listener%2C-getting-the-element-observed-... > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
