是否有一种方法可以调用 jquery 按钮点击在同一个对象内配置的公用方法? 在下面我向您展示我被尝试过的多重方式 。
var myClass = new MyClass();
function MyClass() {
this.func1 = function () {
alert("Hello World");
}
var me = this;
$("#my-button").click(function(){
//func1(); //dont work (wold like)
//this.func1(); //dont work (would like)
me.func1(); //Work! but is not correct way to do it
myClass.func1(); //Work! but the idea its that recognize itself widthout call public instance
});
}
其它办法?