I received a code snipper from here: http://jsdude.wordpress.com/2012/12/19/jquery-event-callbacks-and-javascript-oop-methods/:
var CounterButton = function(el){
this.$el = $(el);
this.counter = 0;
this.bindEvents();
this.myVal = 1;
}
CounterButton.prototype.bindEvents = function(){
this.$el.click(this.clicked);
};
CounterButton.prototype.clicked = function(){
this.increase();
this.showMessage();
};
I am trying to figure out this specific line: his.$el.click(this.clicked);
. When you have this
inside the click
function does that refer to whats being clicked on which would be this.$el
?