How to get nth jQuery element

You can use the :eq selector, for example:

$("td:eq(2)").css("color", "red"); // gets the third td element

Or the eq(int) function:

$("td").eq(2).css("color", "red");

Also, remember that the indexes are zero-based.

Leave a Comment