Posted By

breakerjump on 07/27/08


jquery rows odd even Alternating

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Alternating Table Rows via jQuery

 / Published in: JavaScript

Uses jQuery to add a class to odd table rows, for purposes of alternating colors, etc.

  1. $("tr:nth-child(odd)").addClass("odd");

Report this snippet  


RSS Icon Subscribe to comments
Posted By: NeoBlack on July 27, 2008

or do it this way: $('tr:odd').addClass('odd'); $('tr:even').addClass('even');

You need to login to post a comment.