Zebra Table / Zebra Lists


/ Published in: jQuery
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.