I have used datatables jquery in my application. When I used datatables jquery to set alternate colors for my rows, I faced a issue. That is, in a table 2nd,3rd,4th,5th n 6th row are all displayed in same color and after that colors are displayed alternately. Could anyone help me with this? Thanks in advance.
My code in jquery.datatables.css :
table.dataTable tr.odd { background-color: red; }
table.dataTable tr.even { background-color: green; }
I have attached the screenshot of the table.
When I checked, every row is having either class="even" or class="odd" but the 2nd,3rd,4th,5th,6th rows are having class="odd even". I dont know why it is like this.
Found the answer :
table.dataTable tr{ background-color: red; }
table.dataTable tr:nth-child(even) { background-color: green; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With