checkbox 全选 取消全选

来源:互联网 发布:3阶魔方矩阵 编辑:程序博客网 时间:2024/04/29 16:32
       //selectAll 为点击div 
       $('.selectAll').on('click',function(){           switch(selectAll)                    {
<span style="white-space:pre"></span>    //全选                    case 'yes':                    selectAll='no';
<span style="white-space:pre"></span>    //columns下的所有checkbox                    $('.columns :input').each(function(){                    this.checked= false;})                    break;
<span style="white-space:pre"></span>            //取消全选                    case 'no':                    selectAll='yes';                    $('.columns :input:checkbox').each(function(){                    this.checked= true;})                    break;                    default:                      ;                    }        });
//当需要其他反选什么的可以再加几个case OK了
0 0