Categories
JavaScript Answers

How to fix Bootstrap 4 drop down menu is not working with JavaScript?

Spread the love

Sometimes, we want to fix Bootstrap 4 drop down menu is not working with JavaScript.

In this article, we’ll look at how to fix Bootstrap 4 drop down menu is not working with JavaScript.

How to fix Bootstrap 4 drop down menu is not working with JavaScript?

To fix Bootstrap 4 drop down menu is not working with JavaScript, we add popper.js before loading Bootstrap.

For instance, we write

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
<link
  rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
/>

to add the popper.js script tag before the Bootstrap 4 script tags.

Conclusion

To fix Bootstrap 4 drop down menu is not working with JavaScript, we add popper.js before loading Bootstrap.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *