user710946
user710946

Reputation: 29

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 td

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'

Upvotes: 0

Views: 890

Answers (2)

Archan Mishra
Archan Mishra

Reputation: 905

Check out Zebra striping in JQuery

Upvotes: 1

Headshota
Headshota

Reputation: 21449

you can do something like this:

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

Upvotes: 1

Related Questions