I have a table with a bunch of td
with the classes markTD
and they each have a different integer for the attribute value
. I would like to click the button called mark
and change the color of just 1 of the td
.
$('#mark').click(function(){
var h2 = parseInt($('#h2').attr('value'), 10);
//h2 returns the number 3
$('#markTD').find('value',h2).css("color","red"); //this is the line that's not working
}
HTML
<table id='markTable'>
<tr>
<td>Question number:</td>
<?php
$q=1;
while ($q <= $num_rows){
echo "<td class='markTD' value='" . $q . "'>" . $q . "</td>";
$q++;
}
?>
</tr>
</table>