首页 > 代码库 > checkbox全选 反选 不选 并获取id的值

checkbox全选 反选 不选 并获取id的值

 $("#lblContents :checkbox").each(function () {                 if (this.checked) {                     this.checked = false;                     ids ="";                 }                 else {                     this.checked = true;                     ids += $(this).attr("id") + ‘,‘;                 }         });

          $("#lblContents :checkbox").each(function () {                     this.checked = true;                     ids += $(this).attr("id") + ‘,‘;         });          $("#lblContents :checkbox").each(function () {                     this.checked = false;                     ids += ‘‘;         });