Im using bootstrap twitter and I would like my different sites in the menu to show as active when clicked on. I've found the question Bootstrap Twitter CSS Active Navigation which deals with this issue.
My problem is that i cannot make the JQuery function in one of the answers to work. The modifications should be very straight forward to make it work in my case which in HTML is:
<script>
$('body').on('.nav li a', 'click', function()
{
var $thisLi = $(this).parents('li:first');
var $ul = $thisLi.parents('ul:first');
if (!$thisLi.hasClass('active'))
{
$ul.find('li.active').removeClass('active');
$thisLi.addClass('active');
}
});
</script>
<ul class="nav nav-pills pull-left">
<li class="active"> <a href="home.html">Home</a> </li>
<li> <a href="about.html">About</a> </li>
</ul>
Any clues as to what might be the problem? Thank you in advance.