第一種:
全選
$(".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;
});