javascript - Bootbox 警报抛出“未捕获的 TypeError:div.on 不是函数”
问题描述
我使用 bootbox 向用户显示信息和决策消息,但他指责以下错误:“Uncaught TypeError: div.on is not a function”。有人可以帮我解决吗?
在我的代码下面:
<html>
<script src="js/jquery/jquery-1.9.1.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/bootstrap.css"></link>
<script language='javascript' type='text/javascript' src="js/bootstrap.js"></script>
<script language='javascript' type='text/javascript' src="js/bootbox.js"></script>
...
jQuery("#datagrid").navButtonAdd('#pdatagrid', {
caption : '', title : 'Alerta', buttonicon : "ui-icon-link", onClickButton : function () {
top.Base.getUtil().alerta('alerta acionado');
}
});
我的内部框架方法
alerta: function(message){
bootbox.alert( message );
},
在 bootbox.js 中,错误“div.on is not a function”发生在第 409 行
// hook into the modal's keyup trigger to check for the escape key
div.on('keyup.dismiss.modal', function(e) {
// any truthy value passed to onEscape will dismiss the dialog
// as long as the onEscape function (if defined) doesn't prevent it
if (e.which === 27 && options.onEscape) {
onCancel('escape');
}
});
解决方案
推荐阅读
- c# - 单击鼠标从字符串中选择下一个值
- java - Apache Ignite 2.7.5:服务器崩溃并出现“NoClassDefFoundError:sun/nio/ch/Invoker$2”
- r - 如何修复 Rcpp 中内联函数的未定义引用
- windows - 运行时 System.DLLNotFoundException(从 Visual Studio 2017 开始 - x86,调试)
- openid - Symfony 4:如何使用 GuardAuthenticator 实现 OpenId Connect?
- ios - 具有丰富内容的 iOS 推送通知 - 我可以防止通知被点击吗?
- ruby-on-rails - 为什么我的 Heroku 管道审查应用程序无法构建并出现错误:ActiveSupport::EncryptedFile::MissingKeyError
- java - sessionRegistry.getAllPrincipals() 始终为空
- visual-studio-code - 如何在 vs 代码上启用 Suitescript IntelliSense?
- javascript - 为什么当我创建函数的新实例时函数内部的代码会运行