全选

function jsChCheck(objName) {
            $("input:checkbox[name='chkIdx']").each(function () {
                this.checked = objName.checked;
            });
        } 
 <input type="button"  name="chkIdx" onclick='jsChCheck(this)' />
 <input type="checkbox"  name="chkIdx" />

  

function jsChCheck(objName) {            $("input:checkbox[name='chkIdx']").each(function () {                this.checked = objName.checked;            });        } 

原文地址:https://www.cnblogs.com/liucyi/p/5179661.html