javascriptjquerytwitter-bootstrapbootstrap-dialog

jQuery Bootstrap dialog $backdrop is undefined


I'm using Bootstrap dialog link in my application. I have included the dependencies in the head section of the html

    <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>  

I'm getting the error

    Uncaught TypeError: Cannot read property 'css' of undefined

in the line

  $backdrop.css('z-index', zIndexBackdrop + (dialogCount - 1) * 20);

in bootstrap-dialog.js where $backdrop is null.

This is the code i have written

 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();
                    }
                }]
            });
     }

I appreciate all your help.


Solution

  • I got this fixed. The problem was with Bootstrap js version, it was in major version 2. Upgrading to Bootstrap 3 version fixed it.