I tried jquery datatable with tri colored rows which is repeating alternatively.But i got only two colored rows repeating.
Tried jquery datatable with tri colored rows
I'm using property even/odd for coloring
$(document).ready(function() {
$('#example').dataTable();
} );
$(document).ready(function() {
$("#example tr:even").css("background-color", "LightYellow");
$("#example tr:odd").css("background-color", "LightBlue");
});
You don't have to use jquery to implement this CSS is much suitable for that job. try this.
/*tri color rows*/
table.dataTable tbody tr:nth-child(3n+1) {background-color: #FFCCCC;}
table.dataTable tbody tr:nth-child(3n+2) {background-color: #99D6AD;}
table.dataTable tbody tr:nth-child(3n) {background-color: #EBD6FF;}
th {
background: #aaf;
}
thead{
background: #aaf;
}
/* End: tri color rows*/
check this Demo in js fiddle
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