5
I am trying to create a menu where a div wins a class if clicked, but I would like to remove the class from the last link clicked in the menu.
<div id="bolinha-dentro"></div><a href="">Meu link</a>
<div id="bolinha-dentro"></div><a href="">Meu link</a>
<div id="bolinha-dentro"></div><a href="">Meu link</a>
<div id="bolinha-dentro"></div><a href="">Meu link</a>
I want the active class to be added on the link I click and in case I click on the next menu link it will remove the active class and add on another.
$(document).ready(function() {
$('#bolinha-dentro').click(function(){
$(this).toggleClass('active');
});
})
Link to the fiddle this one
the value of the id attribute must be unique in the document: http://www.w3.org/TR/html401/struct/global.html#h-7.5.2
– Pedro Sanção
Did you manage to solve this problem? Did any of the questions help to solve?
– Sergio