【发布时间】:2016-08-20 05:51:42
【问题描述】:
我有一个 WebForm,它继承自 MasterPage,在 WebForm 中我使用了 jQuery 和 JavaScript,因为我想创建一个带有自定义按钮的 dialog box,并且是默认的confirm() 方法不允许任何更改,所以我使用了来自 this website 的资源和代码。我不确定将 JS 源放在哪里,所以我把它们放在中间(如果我做错了请告诉我):
<asp:Content ID="Content2" ContentPlaceHolderID="CSS" runat="server">
</asp:Content>
我从参考资料中得到的来源是:
<script src="~/jquery.confirm.js"></script>
<script src="~/jquery.confirm.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
正如从参考中复制的一样,这是我的 jQuery dialog box:
$("#Button1").confirm({
title: "Confirmation Message",
text: "Are you sure that the information you have entered is accurate?",
confirm: function (button) {
return true;
},
cancel: function (button) {
return false;
},
confirmButton: "Yes",
cancelButton: "No"
});
每当我尝试运行我的代码时,总会弹出此错误:
对象不支持“确认”属性或方法。
我尝试过使用各种 JS 源和 jQueries,因为我是新手,但它们都不起作用。我该如何解决这个问题?
【问题讨论】:
-
为什么你把confirm.min,js和confirm.js这两个文件都包含进去了??只需要一个
标签: javascript jquery asp.net .net webforms