Add class then remove class when click

前端 未结 2 1389
故里飘歌
故里飘歌 2021-01-28 10:03

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 th

2条回答
  •  一向
    一向 (楼主)
    2021-01-28 10:58

    Try this

    $(function(){
      $("#menu1").click(function(){
          $(this).toggleClass("active");
          $("a.mm-title").toggleClass("remove");
      });
     });
    

    Let me know if it is helpful

提交回复
热议问题