.even() 3.5 Reduce the set of matched elements to the even ones in the set, numbered from zero.

Given a jQuery object that represents a set of DOM elements, the .even() method constructs a new jQuery object from the even elements in that set. Counting starts from zero!

Consider a page with a simple list on it:


<ul>
  <li>list item 1</li>
  <li>list item 2</li>
  <li>list item 3</li>
  <li>list item 4</li>
  <li>list item 5</li>
</ul>
    

We can apply this method to the set of list items:


$( "li" ).even().css( "background-color", "red" );
    

The result of this call is a red background for the first, third & 5th items.

Highlight the even items in a list.
  • Look:
  • This is some text in a list.
  • This is a note about it.
  • This is another note about it.
  • ]]>