jQuery Alternating Row Colors


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

This one is simple yet very useful. You can do alternating row colors with 2 simple lines of jQuery


Copy this code and paste it in your HTML
  1. //jquery
  2. $('div:odd').css("background-color", "#F4F4F8");
  3. $('div:even').css("background-color", "#EFF1F1");
  4.  
  5.  
  6. //html example
  7. <div>Row 1</div>
  8. <div>Row 2</div>
  9. <div>Row 3</div>
  10. <div>Row 4</div>
  11.  
  12. //you can use td, tr, li, etc..

URL: http://www.codespuds.com/jquery-alternating-row-colors/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.