[jQuery] Re: Scope and Visibility from Callback

2007-10-05 Thread NeilM
That's great - thanks. The only question I have now is whether it would be possible to modify a prototype somewhere/somehow to provide this property automatically? On Oct 5, 8:53 am, Suni <[EMAIL PROTECTED]> wrote: > Your problem is that within the function you no longer have a > reference to my

[jQuery] Re: Scope and Visibility from Callback

2007-10-05 Thread Suni
Your problem is that within the function you no longer have a reference to myObj, since this no longer points to it. Try this trick (works): var myObj = { foo : function() { var that = this; $("#myLink").click(function(){ that.bar(); }); }, bar : function(){ } };