对象不支持属性或方法“确认”
Object doesn't support property or method 'confirm'
我有一个继承自MasterPage
的WebForm
,在WebForm
我使用了jQuery和JavaScript,这是我的新手,因为我想创建一个带有自定义按钮的dialog box
,而默认的confirm()
方法不允许任何更改,所以我利用了这个网站的资源和代码。我不确定将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源和jQuery,因为我是新手,但所有这些都不起作用。如何解决此问题?
试试这个:
$('#Button1').on('click', function () {
$.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"
});
});
相关文章:
- electronic BrowserWindow的最小高度和宽度在hide()show()方法之后不起作用
- 有没有任何方法可以将控制器从文件加载到ui路由器$stateProvider中
- 数组在递归方法中设置为null
- 打破承诺链的好方法是什么
- 如何为javascript方法放入jquery确认对话框
- 对象不支持属性或方法“确认”
- 提交表单前使用确认对话框的正确方法
- 在浏览器关闭时,单击确认对话框中的“停留在页面上”,执行一个方法
- 正在寻找特定的JS方法来确认单选按钮的选择
- 是否有任何方法可以在单击“加载前确认”对话框的“确定”按钮后执行某些操作
- 如何在代码隐藏上使用 javascript 确认方法
- link_to :方法并确认:不起作用
- 分机.js确认方法添加新行字符
- javascript可以从一个单独的方法监听确认对话的结果
- 是否有一个简单的方法来改变确认和警报在这个页面.间谍摩卡的例子
- 如何运行SweetAlert而不是默认的javascript确认方法
- JS确认后执行post方法
- 是否有其他参数可以传递给Javascript原生确认/警报方法?
- 离开站点时使用确认方法
- 如何在javascript中触发一个类的密码确认方法,每次调用其他方法之一