我正在尝试编写一个jQuery对话框,当我点击“确定”按钮时,每次点击它都会发送数据。
所以,无论是多次点击还是一次点击“确定”按钮,我都需要它才能工作一次。
$.dialogue({
class: 'big',
body: html,
yes: {
text: 'ok',
func: function() {
//execute some codes
}, //end function
},
no: {text: 'Cancel'},
});
答案 0 :(得分:1)
$.dialogue({
class: 'big',
body: html,
yes: {
text: 'ok',
func: (function() {
var executed = false;
return function () {
if (!executed) {
executed = true;
//execute some codes
}
};
})(), //end function
},
no: {text: 'Cancel'},
});