calling a method from an event handler
- by Ayoub
I have this code i am working on but every time i call init method I keep getting an error
this.addElement is not a function
is it because i can't call methods from event handlers ?
function editor () {
this.init = function () {
$("#area").bind('click' , this.click_event );
}
this.addElement = function () {
console.log("adding element");
}
this.click_event = function(event) {
this.addElement();
console.log("click event in x : "+event.data);
}
}