Based on the Pinegrow blog template, I have a master page with this menu (here abbreviated)
<nav class="bg-white navbar navbar-expand-md navbar-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-center navbar-nav">
<ul class="navbar-nav ">
<li class="nav-item active">
<a class="nav-link" href="home.html" data-pgc-field="menuItems">Home </a>
</li>
<li class="nav-item">
<a class="nav-link" href="history.html" data-pgc-field="menuItems">History</a>
</li>
</ul>
</div>
</div>
</nav>
then at the end of the html
<script>
$(document).ready(function() {
"use strict";
$('ul.navbar-nav > li').click(function(e) {
//e.preventDefault();
$('ul.navbar-nav > li').removeClass('active');
$(this).addClass('active');
});
});
</script> -->
</body>
</html>
When the page is served, the links when clicked refresh to the correct new page, but the highlighted menu item does not change.
If I remove the comment from e.preventDefault(), the menu highlights function, but the browser remains pointed at the same page.
Would appreciate help seeing where I am going wrong, to get both links and highlights working as expected…