您可以使用在不同问题中找到的相同结构并在此处应用它。
HTML:
<div id="confirm" style="display:none;"></div>
JavaScript:
function showConfirmDialog(message) {
$("#confirm").html(message);
$("#confirm").dialog('open');
}
$(function() {
var submitForm = $('.oneUser');
var submit = false;
$("#confirm").dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
'Submit': function() {
$(this).dialog('close');
submit = true;
submitForm.submit();
},
'Cancel': function() {
$(this).dialog('close');
}
}
});
$("#confirm").parent().appendTo($(".oneUser"));
submitForm.submit(function() {
if (submit) {
return true;
} else {
showConfirmDialog("Record will be deleted! <BR /> Are you sure?");
return false;
}
});
});