js 多选 反选

//$(".435__1").attr("checked", true);
//$(".435__0").removeAttr("checked");
$("."+pid+"__1").attr("checked", true);
$("."+pid+"__0:checked").removeAttr("checked");

 

 

$('input:checkbox').click(function () {
var projid_name = $(this).attr("name");
var projid_name_str= new Array(); //定义一数组
projid_name_str=projid_name.split("_");
pname_1 = projid_name_str[0]+"_"+projid_name_str[1]+"_1";
pname_0 = projid_name_str[0]+"_"+projid_name_str[1]+"_0";
if(projid_name_str[2]==1){
$("input[name="+pname_0+"]:checked").removeAttr("checked");
}else if(projid_name_str[2]==0){
$("input[name="+pname_1+"]:checked").removeAttr("checked");
}
});

 

 

/*
$("#435 :checkbox[checked]").each(function(i){
valArr[i] = $(this).val();
});
*/

 

你可能感兴趣的:(js)