1
I have a list containing "Urls" for other pages, I’m having difficulty to pick up the URL of the current page and check if the extracted pathname is in my list of Urls, if it exists I should add the 'active' class to the li that surrounds the link.
Following list mentioned above:
<ul class='nav navbar-nav navbar-right menuHover'>
<li>
<a href='/'>
<span>
Página Inicial
</span>
</a>
</li>
<li class='dropdown'>
<a href='/cursos'>
<span>
Cursos
</span>
</a>
</li>
<li>
<a href='contact3.html'>
<span>
Contato
</span>
</a>
</li>
</ul>
The code below takes the pathname of the URL:
$(document).ready(function() {
$(location).attr('href');
var pathname = window.location.pathname.replace('#', '');
alert(pathname);
});
Which Server-Side language is using ?
– Diego Souza