Book has:
CheckList.prototype.addClickHandler = function(fn) {
this.$element.on(‘click’, ‘input’, function(event) {
var email = event.target.value;
this.removeRow(email);
fn(email);
}).bind(this);
};
but I get an error in Chrome because ‘this’ is resolved to this.$element. Why is that since bind(this) is used?
If I add a variable for this, then I get it to work:
CheckList.prototype.addClickHandler = function(fn) {
var checkList = this;
this.$element.on(‘click’, ‘input’, function(event) {
var email = event.target.value;
checkList.removeRow(email);
fn(email);
});
};