开发者

dynamically change alternate row colors

开发者 https://www.devze.com 2023-03-02 09:59 出处:网络
I have 5 tr, these are row alternate color.Now how to change tr color dynamically when I delete some row.

I have 5 tr, these are row alternate color. Now how to change tr color dynamically when I delete some row.

Assume below is table tr and t开发者_开发知识库d

this is my row

tr class='odd'  
tr class='even'
tr class='odd'
tr class='even'
tr class='odd'
tr class='even'
tr class='odd'


tr class='odd'
tr class='even' if I delete this tr, than 
tr class='odd'
tr class='even'
tr class='odd'
tr class='even'
tr class='odd'


tr class='odd'
tr class='even'  class changed  odd to even
tr class='odd'   class changed  even to odd
tr class='even'  class changed  odd to even
tr class='odd'   class changed  even to odd
tr class='even'  
tr class='odd'


you can do something like this:

$('table tr:even td').css("background-color":"");
$('table tr:odd td').css("background-color":"");


Check out Zebra striping in JQuery

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号