我试图阻止多个事件触发。jquery bind stoppropagation回调上下文
我使用一个回调函数传递一个对象,像这样:
function init() {
var myObj = this.someObject;
$('#id').bind("blur keyup change", function (e, obj) {
return function() {
SomeFunction(e, obj);
}
} (this, myObj));
}
function SomeFunction(e, obj) {
e.stopPropagation();
//do something with the object
}
的错误是,它无法找到函数stopPropagation。
这是因为我在调用函数中将'this'赋值给e。
如何访问SomeFunction中的“事件”?
请忽略此评论 –