jquery怎么设置单选按钮选中
要设置单选按钮选中,可以使用prop()
方法或者attr()
方法。
使用prop()
方法:
// 设置单选按钮选中
$("#radioButton").prop("checked", true);
使用attr()
方法:
// 设置单选按钮选中
$("#radioButton").attr("checked", true);
请将#radioButton
替换为实际的单选按钮的选择器。
要设置单选按钮选中,可以使用prop()
方法或者attr()
方法。
使用prop()
方法:
// 设置单选按钮选中
$("#radioButton").prop("checked", true);
使用attr()
方法:
// 设置单选按钮选中
$("#radioButton").attr("checked", true);
请将#radioButton
替换为实际的单选按钮的选择器。
扫码添加客服微信