In the "alert" or "confirm" custom field, the remaining code gets executed before clicking ok
I created two alert and confirm functions to override the alert and confirm box.
alert()
{
$('#alertModal').modal('open');
}
confirm()
{
$('#confirmModal').modal('open');
}
And calling it:
function Test()
{
var x = confirm('are you confirm?');
y = 11;
}
Normally, the statement is y=11
not executed unless the user clicks the "ok" or "cancel" button. But in my usual confirmation, the operator y=11
has to do the execution before clicking "ok" or "cancel".
+3
source to share
1 answer
You can use, for example, the jQuery interface to create a confirmation dialog like:
$(document).on('click', '.delete-file', function () {
var data = $(this).data(),
fileId = data.fileId;
$('<div><p>Are you sure you wish to delete this file?</p></div>').dialog({
title: 'Delete Confirmation',
modal: true,
resizable: false,
draggable: false,
closeOnEscape: true,
buttons: [
{
text: 'Yes',
click: function () {
// handle your stuff here
$(this).dialog('destroy');
}
},
{
text: 'No',
click: function () {
$(this).dialog('destroy');
}
}]
});
});
0
source to share