本实例需要使用到的html代码:
<input type=\"radio\" name=\"rd\" id=\"rd1\" value=\"1\">1
<input type=\"radio\" name=\"rd\" id=\"rd2\" value=\"2\">2
<input type=\"radio\" name=\"rd\" id=\"rd3\" value=\"3\">3
设置第一个Radio为选中值:
$(\'input:radio:first\').attr(\'checked\', \'checked\');
或者
$(\'input:radio:first\').attr(\'checked\', \'true\');
设置最后一个Radio为选中值:
$(\'input:radio:last\').attr(\'checked\', \'checked\');
或者
$(\'input:radio:last\').attr(\'checked\', \'true\');
注: attr("checked",'checked')= attr("checked", 'true')= attr("checked", true)
继续阅读与本文标签相同的文章
下一篇 :
区块链成重要突破口,与币圈无关却与5G有关联
-
全球首条“5G自动微公交”示范线路乌镇开通
2026-05-14栏目: 教程
-
未来十年,最为吃香的4个大学专业,毕业后就是香饽饽!
2026-05-14栏目: 教程
-
还不会制作填充地图,试试这种方法,2分钟搞定,让你秒变大神
2026-05-14栏目: 教程
-
顺丰自研机器人惊艳亮相,化身“快递小哥”亮绝活,盯上万亿市场
2026-05-14栏目: 教程
-
女生“主动”与你分享这3个秘密?520%偷偷喜欢你,臭弟弟冲鸭
2026-05-14栏目: 教程
