Skip to content Skip to sidebar Skip to footer

Bootstrap.js Accordion Active Index?

I am attempting to retrieve the active index so that I can use previous / next buttons, and also error check the form values in each stage of the accordion. Is there a way to get t

Solution 1:

var index = $('#accordion .in').parent().index();

Solution 2:

You can get the accordion-group that is a accordion item, using that:

var accordionItem = $('.accordion .accordion-body.in:first').parents('.accordion-group');

Now you can get the index of accordionItem.

Post a Comment for "Bootstrap.js Accordion Active Index?"