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

WBOY
Release: 2016-05-16 16:08:26
Original
1844 people have browsed it

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;
Copy after login

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");
});
Copy after login

I hope this article will be helpful to everyone’s jQuery programming.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template