English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery :eq() Selector

jQuery Selectors

The :eq() selector selects elements with a specific index number.

The index number starts from 0, so the index of the first element is 0 (not1)

This is often used with another selector to select a specific element at a certain index in a group (as shown in the following example).

Syntax:

$ (":eq(index)")

Example

Select the third <tr> element:

$ (document).ready(function() {
  $("tr:eq(")2)").css("background", "coral");
});
Test See‹/›

Parameter Value

ParametersDescription
indexSpecify the index of the element

jQuery Selectors