Tuesday 20 December 2011

jquery Zebra Striped Tables

Using jQuery its easy to create Zebra Stripes effect(alternating colored backgrounds) on table rows.
For this we need to define a css class and through jQuery we will apply style to each odd number table rows.

<style>.altRow{background-color: #f0f0f0; }</style>

jQuery:
<script type="text/javascript">// $(function() {
$("table tr:odd").addClass("altRow");
});
</script>

No comments:

Post a Comment