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.

5/5 - (2 votes)
LT Digital Team (Content & Marketing)
Latest posts by LT Digital Team (Content & Marketing) (see all)
All-In-One Membership Access PRO version of all 500+ all Joomla! templates and WordPress themes. Just from $7.25/MO Learn more
🎉 Merry xMas & Happy New Year sale! Grab 50% Off for everything on today, don't miss it. Coupon code: XMASNEWYEAR Redeem Now