You can accomplish this by setting the class to all even rows in the table.
<html> <head> <title>Example Title</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('tr:even').addClass('alt-row-class'); }); </script> </head> <body>...</body> </html>
Then apply the style to this class using standard css:
.alt-row-class { background-color: green; }
The comment correctly indicates that you can play with the ( tr:even ) selector to get the results that you want to relate to the tbody , thead and tfoot .
source share