user1629798
user1629798

Reputation: 1

Conditional formatting on a table

I'm trying to add conditional formatting to the following;

<tr>
    <td><h3>Company</h3></td>
    <td><h3>Price</h3></td>
    <td><h3>Change</h3></td>
</tr>     

<tr>
    <td>Example</td>
    <td>123.4</td>
    <td>-1</td>
</tr>

Where if column "change" is 0 or below the font is red, and green if else.

I found this fiddle, http://jsfiddle.net/davidThomas/Ty497/, which I can adapt, but I can't get it to only work on the third column.

Upvotes: 0

Views: 748

Answers (2)

perumalla srikanth
perumalla srikanth

Reputation: 1

I've gone through the provided link.

The solution for your problem is to change the code in two places:

  1. Change the condition in the function for poor is 1 and very poor to 0.

  2. Change the color for poor in the css part.

Upvotes: 0

Jon
Jon

Reputation: 437386

Simply change the jQuery selector to $('tbody tr td:nth-child(3)') so that it only applies to the third cell of each row.

Upvotes: 5

Related Questions