On the Bootstrap website the subnav matches up with the sections and changes background color as you or scroll to the section. I wanted to create my own menu without all the
anyone having problems with this using jsp, watch your packages.
document.location.pathname gave me: /packagename/index.jsp
but my href in my navbar called just index.jsp
So to edit konsumer's answer:
$(document).ready(function() {
var string = document.location.pathname.replace('/Package Name/','');
$('ul.nav > li > a[href="' + string + '"]').parent().addClass('active');
} );