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
精彩评论