text color in column

text color in column

smicrozsmicroz Posts: 3Questions: 0Answers: 0


I trying to change a color of text in one column if certain conditions are met. In the column the data type are Number, then if greater than 0 color green and if smaller than 0 color red.

To do this usually I set class in the <td class="changeColor"></td> and with Jquery / Lodash


if($(this).text() > 0){
$(this).css('color', 'green);
}else if($(this).text() < 0){
$(this).css('color', 'red');

In my datatable I have 50 entries, but this code only select 30 items.

Any suggestion?



Sign In or Register to comment.