I have an anchor text that when click adds an active class to another class. I want to remove it when it has an active class or if I click the anchor text again. How can I do that?
HTML:
<a id="menu1" href="#menu">BUTTON</a>
<a class="mm-title">TITLE</a>
JAVASCRIPT:
$(function(){
$("#menu1").click(function(){
$(this).addClass("active");
$("a.mm-title").addClass("remove");
});
});
CSS:
.remove { display: none; }
Tried using this one but seems to have a problem with toggling back to inactive state. the 2nd click doesnt do anything but by the third time goes back to normal
JAVASCRIPT:
$(function(){
$("#menu1").click(function(){
$(this).toggleClass("active");
$("a.mm-title").toggleClass("remove");
});
});