Selector.nth Method

Selects an element with the specified index in the matched set.

Selector().nth(index) → Selector
Argument Type Description
index Number The zero-based index. If index is negative, the index is counted from the end of the matched set.


// Selects the third input element.
const secondInput = Selector('input').nth(2);

// Selects the last div element.
const lastDiv = Selector('div').nth(-1);