【发布时间】:2016-07-16 07:42:21
【问题描述】:
我正在尝试编写一个 jQuery 对话框,当我单击“确定”按钮时,每次单击它都会发送数据。
因此,无论是多次单击还是单击“确定”按钮一次,我都需要它只工作一次。
$.dialogue({
class: 'big',
body: html,
yes: {
text: 'ok',
func: function() {
//execute some codes
}, //end function
},
no: {text: 'Cancel'},
});
【问题讨论】:
-
你从哪里得到“$.dialogue”插件的?
-
你有一个
var checker = true; put your code inside if(checker){//code here checker= false;} -
取决于插件,它会将
this作为被点击的按钮或对话框本身传递。如果是按钮,您可以这样做:func: function() { $(this).hide();(或禁用它,取决于它如何创建“按钮”)。 -
或者只是添加一个标志
if (clicked) return; clicked=true; -
现在它正在发布我点击次数的数据\/_\/
标签: javascript jquery jquery-ui jquery-plugins jquery-ajaxq