JavaScript confirm box with custom buttons
问题 Can I write a custom confirm box in JavaScript that, instead of the default OK and CANCEL button, shows a SAVE and DELETE button? 回答1: Use the jQuery UI Dialog Box for this. You can do something like this: JS: $(function() { $("#dialog-confirm").dialog({ resizable: false, height: "auto", width: 400, modal: true, buttons: { "Do it": function() { $(this).dialog("close"); }, Cancel: function() { $(this).dialog("close"); } } }); }); <link href="https://jqueryui.com/jquery-wp-content/themes/jquery