首页 > 网站 > WEB开发 > 正文

jQueryUI实现的自定义confirm确认框简单介绍

2024-04-27 15:03:05
字体:
来源:转载
供稿:网友

jQuery UI实现的自定义confirm确认框简单介绍:
本章节介绍一下jQuery UI自定义了一个confirm的确认对话框效果。
通过html代码自定义对话框的显示界面和外观,可以自定义confirm框的按钮。
本例中定义了一个confirm确认按钮和一个cancel取消按钮。
html代码:

<button id="callConfirm">Confirm!</button><div id="dialog" title="Confirmation Required">确定要删除元素?</div>

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

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=17363

更多内容可以参阅http://www.softwhy.com/jqshili/


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表