0

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 the active index of the accordion?

2 Answers 2

3
var index = $('#accordion .in').parent().index();
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.