要设置单选按钮选中,可以使用prop()
方法或者attr()
方法。
使用prop()
方法:
// 设置单选按钮选中
$("#radioButton").prop("checked", true);
使用attr()
方法:
// 设置单选按钮选中
$("#radioButton").attr("checked", true);
请将#radioButton
替换为实际的单选按钮的选择器。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:php单选按钮的默认选中设置