Home  >  Article  >  Web Front-end  >  jQuery UI插件自定义confirm确认框的方法_jquery

jQuery UI插件自定义confirm确认框的方法_jquery

WBOY
WBOYOriginal
2016-05-16 16:08:261698browse

本文实例讲述了jQuery UI插件自定义confirm确认框的方法。分享给大家供大家参考。具体分析如下:

这段代码通过jQuery UI自定义了一个confirm的确认对话框效果,通过html代码自定义对话框的显示界面和外观,可以自定义confirm框的按钮,本例中定义了一个confirm确认按钮和一个cancel取消按钮。

html代码


Are you sure about this?

jS代码:

$("#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");
});

希望本文所述对大家的jQuery程序设计有所帮助。

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