The jQuery UI plug in customizes the method of the confirm confirmation box

  • 2020-05-17 04:45:22
  • OfStack

This example shows how the jQuery UI plug-in customizes the confirm validation box. Share with you for your reference. The specific analysis is as follows:

This code customizes the effect of an confirm confirmation dialog through jQuery UI, and the buttons of the confirm dialog can be customized through the html code customizing the display interface and appearance of the dialog. In this case, an confirm confirmation button and an cancel cancel button are defined.

html code


<button id="callConfirm">Confirm!</button>
<div id="dialog" title="Confirmation Required">
 Are you sure about this?
</div>​

jS code:


$("#dialog").dialog({
  autoOpen: false,
  modal: true,
  buttons : {
    "Confirm" : function() {
      alert("You have confirmed!");
    },
    "Cancel" : function() {
     $(this).dialog("close");
    }
   }
  });
$("#callConfirm").on("click", function(e) {
  e.preventDefault();
  $("#dialog").dialog("open");
});

I hope this article has helped you with the jQuery programming.


Related articles: