简体   繁体   English

bootstrap.js手风琴有效索引?

[英]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 the active index of the accordion? 有没有办法获取手风琴的有效索引?

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

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. 现在您可以获得手风琴项的索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM