jQuery show.bs.collapse event for nested Bootstrap collapsible buttons fires on more buttons than expected

前端 未结 3 1451
庸人自扰
庸人自扰 2021-02-14 12:55

I\'m using Bootstrap to make collapsible nested divs/buttons. I want to collapse all siblings of a div when it is expanded and to collapse all children of a div when it is colla

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-14 13:32

    you can try below code -

    $('.accordion-toggle').click(function(){
           $(this).parent()
                   .find("i.indicator")
                   .toggleClass('fa-caret-down fa-caret-up');
      });
    

提交回复
热议问题