【发布时间】:2010-11-26 22:51:35
【问题描述】:
我的代码看起来像这样......
function Finder(id) {
this.id = id;
this.input = $("#" + this.id + " :input[type='text']:first")[0];
$(this.input).bind('keyup'....);
this.KeyUpHandler = function (e) { ..the event should trigger this.. }
this.input = 在“id”中找到的第一个输入类型元素,这就是我将要引用的内容。这可以满足我的需要。
然后我想要做的是在“输入”上绑定 keyup 事件。但是我希望事件引用我的函数中包含的实例方法 - this.KeyUpHandler()。
如果我刚刚在输入的标记上执行此操作(onkeypress="keyuphandler();"),我还需要将“e”作为已传递给函数的事件。
有什么想法可以将事件绑定到我正在使用的函数实例中的函数吗?
【问题讨论】:
标签: javascript jquery