I still like the rescope function. :) http://groups.google.com/group/jquery-en/browse_thread/thread/43644231b5764f12?q=rescope+jquery#ca1b1069580a3f25
On Sat, Feb 7, 2009 at 8:03 PM, Karl Rudd <karl.r...@gmail.com> wrote: > > Assign "this" to a local variable. > > function blah() { > var blahThis = this; > someExternalFunction( function() { > blahThis.doSomething(); > } > } > > Karl Rudd > > On Sun, Feb 8, 2009 at 9:28 AM, Alexander <kayuch...@gmail.com> wrote: >> >> Goodday! >> Could anyone tell me how to save "this" context inside callback? >> Here is simple example: >> >> var myClass = jQuery.Class.create({ >> init: function(){ >> this.value = "value"; >> >> // callback as argument: >> someExternalFunction( function() { >> this.setValue(); // PROBLEM: "this" is not >> myClass pointer >> anymore! >> } ); >> }, >> >> setValue: function () { >> this.title = "new value"; >> } >> }); >> >