[jQuery] Re: $.ui.widget and scoping: how to get a reference to the widget instance from within a click event handler?

2008-06-25 Thread Bramus!
Hi Michael, thanks for you extensive reply. Now that I see your code I feel so stupid ... it's so obvious! Looks I've been staring at the code too long yesterday :-D Anywho, I based myself upon your fix, yet keeping the clickHandler function as a separate method on the object. Here's the resulti

[jQuery] Re: $.ui.widget and scoping: how to get a reference to the widget instance from within a click event handler?

2008-06-24 Thread Michael Geary
The general answer to anything like this in JavaScript is "use a closure." In fact, you're already doing that in your code, where you have "var self = this;". So you can simply take your clickHandler function and not make it a method of anything (because it won't be called as a method anyway) - i