• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

formating a cell colour depending on the value?

is it possible to format the color of  a cell in a table depending on the input value in the cell? Can someone let me know how this can be done? Thank you.

1 Solution
Gurvinder Pal SinghCommented:
var allCells = document.getElementsByTagName("td");

for ( var counter = 0; counter < allCells.length; counter++)
   var cell  = allCells[ counter ];
   if ( cell.innerHTML == "" )//put whatever value you want to check
          cell.style.color = "red";
Kiran SonawaneProject LeadCommented:
Ray PaseurCommented:
Please post an example of the table and show us what cells should be colored, Thanks.
check this out


as long as each cell you want to be able to modify is of class "status", you could put this code inside documjent ready function

  $('.status:contains("Paid")').css('color', 'red'); 

Open in new window

aej1973Author Commented:
Thank you for the help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now