I have a class (or function-containing object; I\'ve heard that there is no such thing as a Javascript class) called Foo, with an event handler that is attached to a click e
function Foo() { this.num=0; $(document).on('click', 'element', this, this.eventHandler); this.eventHandler=function(e) { var _this = e.data; _this.num++; } }
1) Use JQuery on() method to attach event listeners. 2) Use a reference _this for accessing parent class.