【发布时间】:2013-09-04 06:31:48
【问题描述】:
我有这样的表格:
<form action="confirm-and-send.php" method="post" onsubmit="return(confirmation());">
<input a lot of input fields here>
<button type="submit" name="confirm_and_send" id="submit-button" class="sent-to-client-bttn" style="margin-left:630px;margin-top: -125px;"></button>
</form>
然后我有 jquery ui 功能
function confirmation(){
$("#some-div").dialog({
bgiframe: true,
autoOpen: false,
minHeight: 200,
width: 350,
modal: true,
closeOnEscape: false,
draggable: false,
resizable: false,
buttons: {
'Yes': function(){
$(this).dialog('close');
callback(true);
},
'No': function(){
$(this).dialog('close');
callback(false);
}
}
});
}
function callback(value){
//do something
}
我正在关注他们所说的 here 和 here,但这对我不起作用。如果我把event.preventDefault() 是按钮将不会提交;如果我不把它提交表格,然后我选择两个选项中的任何一个。谁能给我一个合适的例子?
【问题讨论】:
标签: javascript forms jquery-ui return-value