Uncaught error: bootstrap’s javascript requires jquery – introduction
When you utilize Bootstrap and add jQuery 1.x.x to build up your site, have you ever got the Uncaught error: bootstrap’s javascript requires jquery yet? If yes, do you know how to deal with the trouble? In case you are looking for a useful solution for this issue, let’s take a look at the blog. So, today, we would like to bring you some methods that you can try to get the most suitable one.
How to fix the Uncaught error: bootstrap’s javascript requires jquery?
First of all, let’s make sure that you added jQuery before bootstrap since bootstrap use the features of jQuery. For example, if you are in a Browser-Only environment, then the right order you should try is:
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/wow.min.js"></script>
Besides, in case you are in Node or CommonJS + Browser environment including Electron, Node-Webkit, etc, the main reason that causes the error is that jQuery’s export logic will check the module before the window:
if (typeof module === "object" && typeof module.exports === "object") {
// CommonJS/Node
} else {
// window
}
As it exports itself through the module.exports, both jQuery and $ won’t be assigned to the window. Therefore, you need to change <script src="path/to/jquery.js"></script>;
into a require statement, such as:
<script>
window.jQuery = window.$ = require('jquery');
</script>
Last but not least, in case your electron app doesn’t need nodeIntegration
, simply set it to false
. So, everything is done and you don’t need to use the solution above.
Final thoughts
In conclusion, we hope that some methods we suggested above will be useful for you. Don’t hesitate to try them to solve the trouble quickly. Any idea for this issue? If yes, why don’t you show it to us by leaving your comment below? What’s more? We are providing a lot of high-quality free WordPress Themes, let’s visit our site and get the best one for your site.
- What are joomla tags and how are the used? - November 3, 2024
- Why and how to create hidden menu items in Joomla? - October 31, 2024
- How to publish smartslider 3 to joomla 4? - October 31, 2024
Recent Comments