Posted By

pedromagalhaes on 02/23/11


Tagged

zebra


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

saman
mattvbiggs
dubogii


Zebra Table / Zebra Lists


 / Published in: jQuery
 

This little snippet adds css classes for odd and even, in a way you can style each element.

  1. $(document).ready(function() {
  2. $("table").each(function () {
  3. $(this).find("tr:odd").addClass('zebra_odd');
  4. $(this).find("tr:even").addClass('zebra_even');
  5. });
  6. $(".tablelist").each(function () {
  7. $(this).find("li:odd").addClass('zebra_odd');
  8. $(this).find("li:even").addClass('zebra_even');
  9. });
  10. });

Report this snippet  

You need to login to post a comment.