I am generating a html table through C# code in an MVC Application .
I want to color the value in table cell as red and condition for this is (if column-x value is greater than value of column-y than set color of column-x as red).
column-x and column-y have their on id,s
Below is generated HTML and javascript code which I am using
$('#body table').each(function () { $('#' + this.id + ' ' + 'tr').each(function () { var v1 = $('#TodayPDue').html(); var v2 = $('#TodayIntDue').html(); if (v1 > v2){ $('#TodayPDue').css('color','red'); } }) }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table id='CollectionRPT' class='table table-bordered table-hover'> <tbody> <tr> <td>1</td> <td>BIHAR</td> <td id='TodayPDue'>2220515</td> <td id='TodayIntDue'>457565</td> <td id='TodayPCollected'>0</td> <td id='TodayIntCollected'>0</td> <td id='MonthPDue'>10232468</td> <td id='MonthIntDue'>2058526</td> <td id='MonthPCollected'>5912869</td> <td id='MonthIntCollected'>1167760</td> <td id='YearPDue'>6432342</td> <td id='YearIntDue'>1303773</td> <td id='YearPCollected'>2111473</td> <td id='YearIntCollected'>413023</td> </tr> </tbody> </table> Any idea why it is showing no effect ?
if (v1 > v2)to do?