Say that i have this code
var SomeClass= function(id){
this.id = guidGenerator();
this.htmlElement = jQuery("#"+id);
this.initClickHandler();
};
SomeClass.prototype = {
initClickHandler: function(){
this.htmlElement.on("click",function(e){
//NEED A REFERENCE TO THE OBJECT HERE
//IN A WAY THAT WILL ALLOW SOMETHING LIKE THIS
//this.clickHandler();
});
},
clickHandler: function(){
alert(this.id);
}
};
SomeClassInstance1 = new SomeClass("a");
SomeClassInstance2 = new SomeClass("b");
how can i get the relevant instance of "SomeClass" on the "ON "callback ?