I am a new ASP.NET Web Forms developer and trying to use Twitter Bootstrap with the Master Page. I am struggling with setting navbar item as active when user selects it. I creat
Actually Reynaldo, almost had it... At least for me, this works pretty good, on activing the current option and deactiving the previous one, based on his example.
$(document).ready(function() {
var url = window.location;
$('ul.nav li a').each(function () {
if (this.href == url) {
$("ul.nav li").each(function () {
if ($(this).hasClass("active")) {
$(this).removeClass("active");
}
});
$(this).parent().addClass('active');
}
});
});