I could not get the answer from the dialog box, but in the end I came up with a solution, combining the answer from this other question display-yes-and-no-buttons-instead-of-ok-and-cancel-in-confirm-box with part of the code from modality confirmation dialog
This is what was suggested on another issue:
Create your own flag to confirm:
<div id="confirmBox"> <div class="message"></div> <span class="yes">Yes</span> <span class="no">No</span> </div>
Create your own confirm() method:
function doConfirm(msg, yesFn, noFn) { var confirmBox = $("#confirmBox"); confirmBox.find(".message").text(msg); confirmBox.find(".yes,.no").unbind().click(function() { confirmBox.hide(); }); confirmBox.find(".yes").click(yesFn); confirmBox.find(".no").click(noFn); confirmBox.show(); }
Call it by your code:
doConfirm("Are you sure?", function yes() { form.submit(); }, function no() {
MY CHANGES I changed this above so that instead of calling confirmBox.show() I would use confirmBox.dialog({...}) , like this
confirmBox.dialog ({ autoOpen: true, modal: true, buttons: { 'Yes': function () { $(this).dialog('close'); $(this).find(".yes").click(); }, 'No': function () { $(this).dialog('close'); $(this).find(".no").click(); } } });
Another change I made was to create a confirmBox div in the doConfirm function, as ThulasiRam did in its answer.
JF Jul 02 2018-12-15T00: 00Z
source share