Search code examples
twitter-bootstraptwitter-bootstrap-3accordionbootstrap-accordion

How do I set the active tab in bootstrap accordion?


I'm hunting documentation and hacking classes. Nothing is working. All I want to do is set the active tab in a bootstrap accordion. That's it. I want to build a page (Laravel Blade), pull a variable from the session and use that to set the active accordion tab.

There must, surely be a way to do it?


Solution

  • You can do it in this way. Using jquery--

    $('.accordions').find('.panel-heading  
     a[data-toggle="collapse"]').addClass('actives');
    

    Hope this helps!