[jQuery] Re: Prototype to jQuery: "current" element

2009-01-24 Thread Ricardo Tomasi
Right, my mistake. Only in the onclick handler 'this' refers to window. It's been such a long time since I last used inline handlers that I'd forgotten :) On Jan 24, 9:55 pm, candlerb wrote: > I found the solution. Whilst jRails uses jquery-ui-1.5, it is still > using jquery-1.2.6, and "closest

[jQuery] Re: Prototype to jQuery: "current" element

2009-01-24 Thread candlerb
I found the solution. Whilst jRails uses jquery-ui-1.5, it is still using jquery-1.2.6, and "closest" is a 1.3 feature. The following works just fine: remove Ricardo Tomasi wrote: > 'this' in an attribute event handler refers to 'window', not the > element itself. In my copy of JavaScript,

[jQuery] Re: Prototype to jQuery: "current" element

2009-01-23 Thread Ricardo Tomasi
'this' in an attribute event handler refers to 'window', not the element itself. You're better of using proper event listeners: $('.thing a').click(function(){ $(this).parents('.setting').remove(); }); or a function to which the event will be passed by default: function removeSetting(event){