有没有办法从同一个对象内配置的 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
});
}
别的办法??