将页面中所有的checkbox设成单选得

$(function () {
var allBox = $(":checkbox");
allBox.click(function () {
allBox.removeAttr("checked");
$(this).attr("checked", "checked");
});
});
 
 
$(function(){
$(':checkbox[name=jcxflIds]').each(function(){
$(this).click(function(){
if($(this).attr('checked')){
$(':checkbox[name=jcxflIds]').removeAttr('checked');
$(this).attr('checked','checked');
}
});
});
 
});
原文地址:https://www.cnblogs.com/zhuyeshen/p/10699033.html