/ Published in: jQuery
This little snippet adds css classes for odd and even,
in a way you can style each element.
in a way you can style each element.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function() { $("table").each(function () { $(this).find("tr:odd").addClass('zebra_odd'); $(this).find("tr:even").addClass('zebra_even'); }); $(".tablelist").each(function () { $(this).find("li:odd").addClass('zebra_odd'); $(this).find("li:even").addClass('zebra_even'); }); });