第一种:
全选
$(".checkBoxSelect").each(function() {
$(this).attr("checked", true);
});
反选
$(".checkBoxSelect").each(function() {
if($(this).attr("checked"))
{
$(this).attr("checked", false);
}
else
{
$(this).attr("checked", true);
}
});
$(".checkBoxSelect").each(function() {
$(this).attr("checked", true);
});
反选
$(".checkBoxSelect").each(function() {
if($(this).attr("checked"))
{
$(this).attr("checked", false);
}
else
{
$(this).attr("checked", true);
}
});
第二种
全选
$("#<%=CheckBoxList.ClientID %> input:checkbox").each(function(index,domEle){
if(this.type=="checkbox")
this.checked=true;
});反选
$("#<%=CheckBoxList.ClientID %> input:checkbox").each(function(index,domEle){
if(this.type=="checkbox")
this.checked=!this.checked;
});
$("#<%=CheckBoxList.ClientID %> input:checkbox").each(function(index,domEle){
if(this.type=="checkbox")
this.checked=true;
});反选
$("#<%=CheckBoxList.ClientID %> input:checkbox").each(function(index,domEle){
if(this.type=="checkbox")
this.checked=!this.checked;
});