View Full Version : Change Table CELL Background relative to content (jQuery or JavaScript)

February 24th, 2012, 11:29 PM
If there's a webpage with a table, and the table got lots of cells.

How to make the cells change their background relative to the content of the cells. Example, if the cells content is "1" the background color is green, if its "2" its blue and so on.

I know how to set the CSS properties, like:

//The jQuery way


but how to make it depending on the content?

I've tried lots of things but it didn't work.Btw, I'm new to JavaScript/jQuery so yeah ;D

February 25th, 2012, 12:17 AM
Thread closed, duplicate here : http://ubuntuforums.org/showthread.php?t=1930896