creating confirm dialog in jquery
javascript, jquery, jquery-ui, jquery-ui-dialog
Solution
I am going to answer my own question and this is working fine:
$("#first").dialog({ width: 304, modal: true,
beforeclose: function (e, ui)
{
$("#confirm").dialog({ width: 500, modal: true,
buttons: {
"Confirm": function () {
document.location.href = "/Home/Index";
},
"Cancel": function () {
$(this).dialog('close');
}
}
});
return false;
}
});
Problem
``` $("#first").dialog({ width: 304, modal: true, beforeclose: function (e, ui) { $("#confirm").dialog({ width: 500, modal: true, buttons: { "Confirm": function () { document.location.href = "/Home/Index"; }, "Cancel": function () { $(this).dialog('close'); return false; } } }); } }); ``` The dialog `#first` closes without waiting for the `#confirm` dialog to open. I know about `confirm()` function of javascript but i want to use dialog in this case . How can i do that?