I would like to create a navigation bar with links that will dynamically change the webpage content when clicked using JavaScript. Here is an example of what I currently have:
My Navigation Bar
// Current JavaScript Method (Not Working)
document.getElementById("section2Button").click();
<nav class="navbar navbar-expand-sm bg-primary navbar-dark justify-content-center fixed-top">
<ul class="navbar-nav">
<li id="section1Button" class="nav-item">
<a class="nav-link" href="#section1">Colleges</a>
</li>
<li id="section2Button" class="nav-item">
<a class="nav-link" href="#section2">College Selected</a>
</li>
<li id="section3Button" class="nav-item">
<a class="nav-link" href="#section3">About Me</a>
</li>
</ul>
</nav>