ここからコード スニッパーを受け取りました: 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();
};
私はこの特定の行を理解しようとしています: his.$el.click(this.clicked);
. this
関数内にある場合click
、それはクリックされているものを参照しますthis.$el
か?