Navbar collapse not expanding with dropdown after clicking on it

Collapsing of the navbar uses the collapse plugin, see: http://getbootstrap.com/javascript/#collapse. So add data-toggle="collapse" and a data-target to your navbar button. And add the same class as used for data-target to the nav element of your navbar:

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse">

and:

  <nav class="collapse navbar-collapse" role="navigation">

More about Migrating from Bootstrap v3 to Bootstrap v4 here in docs.


For others who will get here from a web search:

I had this same problem - not being able to expand a navbar - but all of my code was fine. If you've checked your data-toggle per @Bass Jobsen's answer, and are still having issues then check your CDN.

My problem was that I had a network-level ad blocker that was blocking some of my CDN'ed scripts.

Facepalm.