I have a HTML list: <ul class="buttons"> <li><a href="#" class="active">Home</a></li> <li><a href="#">About</a></li> <li><a href="#" class="active">News</a></li> </ul>
I want to obtain the index only for the elements with class="active". For example I want to create an array with value "0" for Home and "2" for News (the indexes). Is possible to do this with jquery? Thanks!