【发布时间】:2013-09-20 20:29:47
【问题描述】:
我在Javascript代码中写了2个函数如下
Manager = FormManager.extend({
First: function () {
var response = this.Second("Feature"); //I'm able to get the alert
//I have added a click event handler
$('#element').on('click', function(){
var newResponse = this.Second("Bug"); //The alert is not poping
});
}
Second: function (type) {
alert(type);
//Performs certain operation
}
});
错误: Uncaught TypeError: Object # has no method 'Second'
我也试过不使用 this 关键字,如
Second("Bug") // Error: There is no method
而在我正在玩的程序中,这是一种简化的格式(为了显示一个简单的示例)。我正在努力找出原因。
谁能指引我正确的道路?
【问题讨论】:
标签: javascript javascript-events event-handling jquery