Is there a way for the javascript method to refer to the environment in which it was defined, as opposed to how it was called? In this particular case, the method is defined in the object literal.
t
var obj = {
init: function(){
jQuery("form").on('keyup','input',{self:this},this.checkDetails);
}
checkDetails: function(event){
console.log(this);
console.log(event.data.self);
}
}
thismust refer to the shared object in which it was defined.
source
share