gpt4 book ai didi

javascript - jquery tr click input radio 勾选

转载 作者:行者123 更新时间:2023-11-30 08:06:30 25 4
gpt4 key购买 nike

<分区>

我已经看过,但无法为我的问题找到简单的答案。我单击其中一个 TR,然后单击另一个 TR,它工作正常,但在单击两个之后,它不再识别对一行的单击。有什么帮助吗?这是 HTML:

<table>
<th>1</th>
<th>2</th>
<tr>
<td>Yes
<input type='radio' name='test' value='yes' />
</td>
</tr>
<tr>
<td>No
<input type='radio' name='test' value='no' />
</td>
</tr>
</table>

这是jquery

$(function () {
$('table tr').click(function () {
$(this).find('input:radio').attr('checked', 'checked');
});
});

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com