I don't really understand how to set listeners in my JavaScript object. For example:
var obj = function(){
this.test = function(){
console.log('test');
}
$(document).on('click','#test',(function(){
this.test();
}).bind(this));
}
But jQuery gives me this error
Uncaught TypeError: Object #test has no method 'apply'
I think there is a proper way but I can't find.
Thanks for your help.
Edit: I don't know really why it works in my example but not in my code