开发者

dynamically change alternate row colors

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜