jQuery:Selector :even

Overview

Matches all elements whose index value is even, counting from zero.

Demo

Description:

The 1, 3, 5 … lines of the lookup table (i.e., index values 0, 2, 4 …).

HTML code:
<table>
  <tr><td>Header 1</td></tr>
  <tr><td>Value 1</td></tr>
  <tr><td>Value 2</td></tr>
</table>
jQuery code:
$("tr:even")
Result:
[ <tr><td>Header 1</td></tr>, <tr><td>Value 2</td></tr> ]

Leave a Reply

Your email address will not be published. Required fields are marked *