1

我正在使用选项在对话框上创建一个按钮。当时点击它时我想调用一个函数...我知道我们可以在那里自己编写逻辑,但我想分享这些东西,所以有单独的功能,但无法调用该函数..代码如下

//here menu is dialog..
//that is scope.    
//this respective ele as this stmnt is inside the loop
menu.dialog("option", "buttons", [{ text: this.text, click: that._addClass(menu, this) }]);

我的功能如下。

 _addClass: function(menu, target){
      do stuff here 
    }

该功能永远不会遇到任何工作,请......

4

1 回答 1

0

尝试更换

click: that._addClass(menu, this)

click: function() { that._addClass(menu, target); }

(事先将其分配给目标)

于 2013-06-07T06:43:56.987 回答