LauraNMS
LauraNMS

Reputation: 2863

getting error Uncaught ReferenceError: BootstrapDialog is not defined

I'm trying to use Bootstrap's modal to send tweets. I downloaded modal.js and bootstrap.min.js into my JavaScript file, but I'm getting the error:

Uncaught ReferenceError: BootstrapDialog is not defined.

Anyone know what I'm doing wrong?

HTML:

<script src="js/bootstrap.min.js"></script>
<script src="js/modal.js"></script>
<script src="js/scripts.js"></script> <!-- my jquery file -->

JavaScript:

setTimeout(function() {
    BootstrapDialog.alert('I want banana!');
}, 1000);

Upvotes: 6

Views: 28103

Answers (5)

Sanket
Sanket

Reputation: 21

setTimeout(function(){
    BootstrapDialog.alert('I want banana!');
}, 1000);

also you have to include this script in your main html file.

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/js/bootstrap-dialog.min.js"></script>  
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/css/bootstrap-dialog.min.css"> 

Also do keep a track on the order in which you are including these scripts.

NOTE:-THIS SOLUTION WORKED FOR ME IT MAY OR MAY NOT WORK FOR YOU.

Upvotes: 2

Waqar Detho
Waqar Detho

Reputation: 1522

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/css/bootstrap-dialog.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/js/bootstrap-dialog.min.js"></script>

Upvotes: 2

Suhail Mumtaz Awan
Suhail Mumtaz Awan

Reputation: 3483

Just add both to the head section

https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/css/bootstrap-dialog.min.css

https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/js/bootstrap-dialog.min.js

Upvotes: 1

Jeremy Thille
Jeremy Thille

Reputation: 26390

You're calling a plugin BootstrapDialog (https://github.com/nakupanda/bootstrap3-dialog) but not including it in your JS files. You're not using only the Bootstrap default modal (http://getbootstrap.com/javascript/#modals)

Upvotes: 6

amphetamachine
amphetamachine

Reputation: 30623

You need to source the bootstrap-dialog.min.js file somewhere before your JavaScript runs.

Upvotes: 2

Related Questions