Ticker

6/recent/ticker-posts

Ad Code

Responsive Advertisement

Uncaught error: bootstrap’s javascript requires jquery

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)

The post Uncaught error: bootstrap’s javascript requires jquery appeared first on LTHEME.

Enregistrer un commentaire

0 Commentaires