jQuery Alternating Table Row Formatting


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



Copy this code and paste it in your HTML
  1. <script type="text/javascript" src="../css-js/jquery-1.4.2.min.js"></script>
  2.  
  3. <script type="text/javascript">
  4. $( function()
  5. {
  6. $( ".informationTable tr:nth-child(even)" ).addClass( "rowDark" );
  7. $( ".informationTable tr:nth-child(odd)" ).addClass( "rowLight" );
  8. $( ".informationTable th" ).addClass( "rowHeader" );
  9. });
  10. </script>
  11.  
  12. <!-- Reference: http://docs.jquery.com/Tutorials:Zebra_Striping_Made_Easy -->

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.