alternate row colors using jquery

后端 未结 6 1325
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 18:38

Using jQuery and not CSS, is it possible to alternate row colors between records? If so can anyone provide a short code script on how to accomplish this?

6条回答
  •  余生分开走
    2021-02-05 19:29

    I used following code to change color of alternate row. I have taken reference from http://www.tutsway.com/set-alternate-row-colors-in-jQuery.php

    window.jQuery(document).ready(function(){
           window.jQuery("tr:odd" ).css("background-color","#fbcff5" );
           window.jQuery("tr:even").css("background-color","#bbbbff");
        });
    

提交回复
热议问题