0

trying to get the background of a boolean value to change based upon true or false... trying this code and its not working with a bit field however does work on a string, any ideas guys?

if (contentItem.value && contentItem.value.substring(0, 1) == 1) {
    $(element).closest("td").css("background-color", "green");
}

and the below code changes the whole column based on the top row value only:

if (contentItem.value = 1) {
    $(element).closest("td").css("color", "green");
}
else 
{
    $(element).closest("td").css("color", "red");
}
4

1 回答 1

0

got it:

if (contentItem.value && contentItem.value == 1) {
    $(element).closest("td").css("color", "green");
}
else 
{
    $(element).closest("td").css("color", "red");
}
于 2014-09-02T08:27:07.417 回答