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);
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)
You need to source the bootstrap-dialog.min.js
file somewhere before your JavaScript runs.
<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>
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With