1
<table>
<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>
</table>
Comment régler le font-weight: bold
dans tr
où chID == crID
Comparer le contenu des cellules de table HTML JavaScript
Je code écrit JS comme ci-dessous
$(function() {
for (var i = 0; i < 20; i++)
{
if ($('#cr' + i).val() == $('#ch' + i).val())
{
$('#cr' + i).parent().css('font-weight', 'bold');
}
}
});
Mais il ne fonctionne pas. Faites-moi savoir comment je devrais atteindre la sortie désirée?