I'm using the bootstrap and I have a menu, what I wanted was that when I clicked on a link from that menu, I'd display the page and leave the page that the user selected on the menu.
I tried to assign a class using the .addClass()
function when the user clicked the menu, but when I click it until I see it changes color, however, when the page finishes loading it loses the effect.
My JavaScript code looks like this:
$(document).ready(function() {
$('a.menu').click(function() {
$(this).addClass("style");
});
});
HTML:
<div id="navbar" class="navbar-collapse collapse bloco-menu">
<ul class="nav navbar-nav ">
<li><a class="menu" href="index.html">O Evento</a></li>
<li><a class="menu" href="mensagem-presidente.html">Mensagem da Presidente</a></li>
<li><a class="menu " href="palestrantes.html">Palestrantes</a></li>
<li><a class="menu" href="localizacao.html">Local do Evento</a></li>
<li><a class="menu" href="inscricoes.html">Inscrições</a></li>
<li><a class="menu" href="#contact">Programação</a></li>
<li><a class="menu" href="stands.html">Mapa de stands</a></li>
<li><a class="menu" href="hospedagem.html">Hospedagem</a></li>
<li><a class="menu" href="comissao-organizadora.html">Comissão Organizadora</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
CSS:
.style{color:red;font-weight:bold}
Could someone help me?