【发布时间】:2010-10-18 18:10:23
【问题描述】:
我有这个类,我使用 jQuery 和 Prototype 的组合:
var MyClass = Class.create({
initElements: function(sumEl) {
this.sumEl = sumEl;
sumEl.keyup(this.updateSumHandler);
},
updateSumHandler: function(event) {
// Throws error here: "this.updateSum is not a function"
this.updateSum();
},
updateSum: function() {
// does something here
}
});
毕竟我怎么能打电话给this.updateSum()?
【问题讨论】:
标签: javascript jquery oop event-handling prototypejs