I'm creating a navbar in boostrap and the dropdown, burger, etc. aren't working. By this I mean they are not expanding when clicked on. I have worked with Bootstrap before and haven't encountered this issue in the past. I'm using Bootswatch from a CDN and just to be safe, I also added the Bootstrap CDN after testing with and without it, I still didn't notice a difference.
I'm using ejs templating(none of which is shown here) in case that's useful to solving the issue. I just wanted my code to be in a form that anyone could test without having to use ejs.
<html>
<head>
<meta charset=”UTF-8">
<meta name=”viewport” content=”width=device-width, initial-scale=1">
<!-- Katex latex renderer-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-D+9gmBxUQogRLqvARvNLmA9hS2x//eK1FhVb9PiU86gmcrBrJAQT8okdJ4LMp2uv" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-483A6DwYfKeDa0Q52fJmxFXkcPCFfnXMoXblOkJ4JcA8zATN6Tm78UNL72AKk+0O" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-yACMu8JWxKzSp/C1YV86pzGiQ/l1YUfE8oPuahJQxzehAjEt2GiQuy/BIvl9KyeF" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
<!-- Bootstrap -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Bootstrap JavaScript -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<!-- Bootstrap JavaScript -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js" integrity="sha384-pjaaA8dDz/5BgdFUPX6M/9SUZv4d12SUPF0axWc+VRZkx5xU3daN+lYb49+Ax+Tl" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Slate Bootswatch theme -->
<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.1.3/slate/bootstrap.min.css" rel="stylesheet" integrity="sha384-ywjdn7N8uoxzIfGl7jlEBlqw2BNicOSzZDgo7A2ffvbM24Ct9plRp7KwtaIqZ33j" crossorigin="anonymous">
<title>title</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="/index.ejs">Home</a>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Notes
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Lambda Calculus</a></li>
<li><a href="#">Languages and Machines</a></li>
<li><a href="#">Logic Programming</a></li>
<li><a href="#">Types and Programming languages</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="/posts.ejs">Posts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about.ejs">About</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row bg-light">
<div class="col-md-auto text-dark">
<div id="notes">
<p>PAGE CONTENT</p>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">© Me. All external content belongs to their respective owners.</span>
</div>
</footer>
</body>
</html>
I recommend you to locate you script tags right before the
<body>
tag ends. You can check this link to understand why is better.Also, you are loading jQuery after Bootstrap links. I modified it.