Table Zebra Striping with jQuery
Tired of all those even/odd classes on your table striping? Bummed out with the lack of CSS3 support in Internet Explorer 6, 7 & 8? Then why not try some jQuery?
Came across a lovely article today entitled Zebra Striping Made Easy which makes zebra-striping… well… easy.
And in only five lines of code:
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("table tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
$("table tr:even").addClass("alt");
});
//]]>
</script>
Lovely.