Posted By

BlueIceStudios on 01/18/11


Tagged

jquery row colors Alternating


Versions (?)

Who likes this?

12 people have marked this snippet as a favorite

mattvbiggs
maltem
johnw
virendrakryadav
czehner
Kurt
uberdragon
jondiscipulo
naphetz
unibox
scilec
ringo380


jQuery Alternating Row Colors


 / Published in: jQuery
 

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

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

  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..

Report this snippet  

You need to login to post a comment.