Get The Index Of An Element Using jQuery Method

preview_player
Показать описание
In this video, we find an element, and then confirm its index among its siblings by invoking the jQuery method index()

// call jQuery index() method
// to yield the index of the active LI item
.invoke('index')
.should('equal', 2)
// if you want to work with the index,
// yield it to the next command
.then(function (index) {
})

Рекомендации по теме