Is there a way for a javascript method to reference the environment in which it was defined as opposed to how it was called? In this particular case - the method is defined in an object literal.
ie:
var obj = {
init: function(){
jQuery("form").on('keyup','input',{self:this},this.checkDetails);
}
checkDetails: function(event){
console.log(this);
// 'this' references the input object which invoked the method
console.log(event.data.self);
//provides a correct reference to the object 'obj', but I had to pass it
}
}
this
should reference the generic object in which it was defined.