哪有网站建设的/网站推广的方法和途径
简单的jQuery代码段,用于设置和取消设置单选按钮上的输入值。 只是想我会分享,因为我在jQuery的早期版本和在表单上设置单选按钮时遇到了一些问题。
//jQuery Set Radio Button
$('input[name="correctAnswer"]').attr('checked', false);//To unselect the button
$("[name=color]").removeAttr("checked");//jQuery (1.4+) code to pre-select one button :
var presetValue = "black";
$("[name=color]").filter("[value="+presetValue+"]").attr("checked","checked");
From: https://www.sitepoint.com/jquery-set-unset-radio-buttons/