Add class then remove class when click

前端 未结 2 1391
故里飘歌
故里飘歌 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:54

    try this example

        
        
       
        
    

    this code will be add sector-active class to clicked a tag and remove sector-active class from another a tag

    if you can add sector-active class to all clicked a tag then comment to following line

    // $('a').removeClass('sector-active');
    

    this will help you

提交回复
热议问题