Change background color and font color of row
Change background color and font color of row
martin1223345
Posts: 84Questions: 23Answers: 0
in General
Hey Guys,
I am using the folowing code to change the background:
if (data.paydays > 0 && data.paydays < 22) {
$('td:eq(0)', row).css('background-color', ' rgba(255, 153, 0, 0.7)'
}
This works fine for the background, now i want the font color to change to so i tried this:
if (data.paydays > 0 && data.paydays < 22) {
$('td:eq(0)', row).css('background-color', ' rgba(255, 153, 0, 0.7)',';color', '#ffffff !important');
}
This is not working, what do i do wrong ?
This question has an accepted answers - jump to answer
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Hey Colin,
See below link. Besides the background I also need the font color to change when the if statement matches.
http://live.datatables.net/banurege/1/edit
Do you mean using something like
$('td:eq(0)', row).css('color', 'blue');
, like this?http://live.datatables.net/banurege/15/edit
Kevin
Yes, thanks you! So making a new row was the sollution insteadt of trying to combine
Using
$('td:eq(0)', row).css('color', 'blue');
is the jQuery css() api not a Datatables function. You can look at the documentation in how to use it. As a setter you can only pass in one propertyName at a time.Its not making a new row.
Kevin