[jQuery] How to save "this" context in callbacks
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";
}
});