Question: I want to change the background color of the cell based on its text contents using jquery.

Example: 

For the second row in the "Exceeds" td, I want to change the background color to green because it has Exceeds as it's text...

```
<table>    
<tr><td>Jedi Armor1</td><td>Needs</td></tr>
<tr><td>Jedi Armor2</td><td>Exceeds</td></tr>    
</table>

```

Answer: 
I'm assuming you want to change the color of the cell and only the cell. If you want to change the color of it based on its text, use the [contains()](http://api.jquery.com/contains-selector/) jQuery selector : 

CSS : 

```
.greenBg {
    background: green;
}

```

jQuery :

```
$("td:contains('Exceeds')").addClass('greenBg');

```

**[jsFiddle Demo](http://jsfiddle.net/Brewal/5wvwC/)**

**Edit :**

If you want to restrict this to the second column only, this would be more suited : 

```
$("td:nth-child(2):contains('Exceeds')").addClass('greenBg');

```

In case someone would want to change the color of the whole column :

```
$("td:nth-child(2):contains('Exceeds')").closest('table').find('td:nth-child(2)').addClass('greenBg');

```

**[jsFiddle Demo](http://jsfiddle.net/Brewal/kLSn8/)**
You can use `.eq()` or `:eq()` selector:

```
$('table tr td:eq(3)').css('background-color','green');

```

or use `.last()` if the `td` that you want to change the color is always the last `td`:

```
$('table tr td').last().css('background-color','green')

```