jQuery Bootstrap对话框$ backdrop未定义

时间:2015-12-29 10:08:22

标签: javascript jquery twitter-bootstrap bootstrap-dialog

我在我的应用程序中使用Bootstrap对话框link。我已将依赖项包含在html

的head部分中
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script> 
    <script src="js/bootstrap-paginator.js" type="text/javascript"></script> 
    <script src="js/bootstrap-dialog.js" type="text/javascript"></script>  

我收到了错误

    Uncaught TypeError: Cannot read property 'css' of undefined

  $backdrop.css('z-index', zIndexBackdrop + (dialogCount - 1) * 20);
bootstrap-dialog.js 中的

,其中$ backdropnull

这是我写的代码

 callback.prototype.success = function(XMLHttpRequest,textStatus){
         showDialog("Title",
                    "Message",
                    BootstrapDialog.TYPE_SUCCESS);

     }


     function showDialog(title,msg,type){
         BootstrapDialog.show({
                title: title,
                message: msg,
                type : type,
                buttons: [{
                    label: 'OK',
                    action: function(dialog) {
                         dialog.close();
                    }
                }]
            });
     }

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。问题在于Bootstrap js版本,它在主要版本2中。升级到Bootstrap 3版本修复了它。