On 2/9/06, Todd Ross <[EMAIL PROTECTED]> wrote: > Event.observe(el, 'click', function(event) { > event = event || window.event; > var element = Event.element(event); > Element.addClassName(element, 'myClass'); > }); > > I'm not sure if there's a more Prototype-centric way to smooth out > retreiving the event in the handler
Sorry ... I know it's bad form to reply to yourself, but I just had a "duh" moment. This is untested, but I think this would work: Event.observe(el, 'click', (function(event) { Element.addClassName(this, 'myClass'); }).bindAsEventListener(el)); So, you were close with your first attempts, but in order for the 'this' to be useful to you, you need to bind it to the element (el), not the window (the default 'this' object). Todd _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs