要使用jQuery设置单选按钮(单选框)为选中状态,您可以使用以下代码:
$('input[type="radio"]').prop('checked', true);
这行代码会选择所有input
元素中type
属性为"radio"的单选按钮,并将它们的checked
属性设置为true
,从而使其选中。
要使用jQuery设置单选按钮(单选框)为选中状态,您可以使用以下代码:
$('input[type="radio"]').prop('checked', true);
这行代码会选择所有input
元素中type
属性为"radio"的单选按钮,并将它们的checked
属性设置为true
,从而使其选中。