一些非常基本的 jQuery 有一个小问题,我希望能够单击表格单元格,然后让它自动选择里面的单选按钮。
HTML:
<table>
<tr>
<td>
1<br>
<input type="radio" name="choice" value="1">
</td>
<td>
2<br>
<input type="radio" name="choice" value="2">
</td>
<td>
3<br>
<input type="radio" name="choice" value="3">
</td>
</tr>
</table>
jQuery:
$("td").click(function () {
$(this).closest('input:radio').attr('checked',true);
});
任何帮助将不胜感激,谢谢!