1
I am making a template and need to put the page active with color different from the other buttons. For this I need to take the contents of one and compare with the page link.
If it’s the same I put a new class in the button where you will pull the css from the active menu.
<script type="text/javascript">
function mostrarAtivo(tag){
var tag_li = document.getElementById('lista_menu');
var tag_a = tag_li.getElementsByTagName('a');
for (i=0; i<tag_a.length; i++ )
{
/* pegar o link da tag a e compara com o link da página, se for igual o link é o link ativo
(recebe uma classe chamada "active"). */
}
}
</script>
Well you don’t have to put the whole script, I just want to know how to get the link inside a tag :
<a href="">
I looked on the internet but could not find, now if you want to put the whole script would be better. But you just need to explain how you get the link to get the link of what the rest I know how to do and after I do I put here the complete answer.
What server-side language you are using ?
– Diego Souza
I’m using Twig, http://twig.sensiolabs.org/ It’s the language they use for the API.
– Felipe Jorge