views:

90

answers:

1

Hello

<tr>
<td class = "nowrap cr" id="cr1">123123</td>
<td class = "nowrap ch" id="ch1">123123</td>
</tr>
<tr>
<td class = "nowrap cr" id="cr2">123123</td>
<td class = "nowrap ch" id="ch2">123123</td>
</tr>
<tr>
<td class = "nowrap cr" id="cr3">467574</td>
<td class = "nowrap ch" id="ch3">123123</td>
</tr>

How do I set the font-weight: bold in tr where chID == crID

<script type="text/javascript">
$(function() {
    for(var i =0;i < 20;i++)
    {
        if($('#cr'+i).val() == $('#ch'+i).val())
        {
            $('#cr'+i).parent().css('font-weight', 'bold');
        }
    }
});
</script>

Dont' working. Any ideas? Sorry for bad english

+2  A: 

val() is for input elements only. You need to use

if($('#cr'+i).html() == $('#ch'+i).html())

or, to compare the textual value only (which is probably what you want)

if($('#cr'+i).text() == $('#ch'+i).text())
Pekka