Getting the accordion id at the specified index

This is the option I asked earlier.

With a Bootstrap accordion, how can I get the id of the panel with the specified index (e.g. index 0)?

thought something line by line

var id = $('#accordion .in').get(0).attr("id");

      

considers

+3


source to share


1 answer


use eq () in jquery.



var id = $('#accordion .in').eq(0).attr("id");

      

+4


source







All Articles