Home › Forums › JavaScript › Get index of hidden element relative to its neighbors › Reply To: Get index of hidden element relative to its neighbors
October 25, 2014 at 1:31 pm
#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
}
});