Home >Web Front-end >JS Tutorial >How to customize the confirm confirmation box with jQuery UI plug-in_jquery

How to customize the confirm confirmation box with jQuery UI plug-in_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:08:261920browse

The example in this article describes how to customize the confirm confirmation box using the jQuery UI plug-in. Share it with everyone for your reference. The specific analysis is as follows:

This code customizes the effect of a confirm confirmation dialog box through jQuery UI. The display interface and appearance of the dialog box are customized through html code. The button of the confirm box can be customized. In this example, a confirm confirmation button is defined. and a cancel button.

html code

<button id="callConfirm">Confirm!</button>
<div id="dialog" title="Confirmation Required">
 Are you sure about this&#63;
</div>&#8203;

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 will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn