I have a table with data columns that contain status. The two status statuses can be โRejectedโ and โPaidโ
What I want to do is change the color of the Rejected text to red and the Paid color to green.
For cells that have this status, I added classes to td as:
<td class="status"> @Html.DisplayFor(modelItem => item.Status) </td>
Therefore, I can easily identify it.
I found that I can change the color of all statuses to red using:
$('.status').css("color", "red");
Also I could get the value of the first:
alert($('.status').html());
However, I am not sure how to set the status color based on its text. those. all Accepted colors are set to red, and all Accepted colors are set to green.
Can someone enlighten me on how to achieve this?
Am I even following the correct approach using jQuery or is there a better css way?
source share