Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Get index of hidden element relative to its neighbors Reply To: Get index of hidden element relative to its neighbors

#187057
itsLeon
Participant

To the $(ul li).each add an check to see if that element had the class hidden and if so add it to an array.

So you get something like.
$(‘ul li’).each(function(i, item){
If $(item).hasClass(‘hidden’){
//$(item).index() will be the index you want
}
});