Twitter bootstrap: adding a class to the open accordion title

前端 未结 11 860
-上瘾入骨i
-上瘾入骨i 2020-12-08 15:58

I am a jquery/javascript newbie. What I want to do is add a class to the open accordion title, and remove it when i open another.

heres the code:

&l         


        
11条回答
  •  情话喂你
    2020-12-08 16:55

    I think this is the simplest way so far.

    $('a.accordion-toggle').on('click', function () {
      $('a.accordion-toggle').removeClass('active');
      $(this).addClass('active');
    });
    

提交回复
热议问题