ansonlh 发表于 2013-1-24 07:08:48

JQuery实现页面中CheckBox全选

继续回馈ITEYE, 绝对原创,JQuery实现CheckBox全选
选择全部的那个checkbox的id设为CheckAll

$(function () {

   // Checkbox 全选
   $("#CheckAll").click(function () {
      if ($(this).attr("checked") == "checked") { // 全选
         $("input").each(function () {
            if ($(this).attr("disabled") != "disabled" && $(this).attr("disabled") != "chkIS_SM")
               $(this).attr("checked", true);
         });
      } else { // 取消全选
         $("input").each(function () {
            if ($(this).attr("disabled") != "disabled" && $(this).attr("disabled") != "chkIS_SM")
               $(this).attr("checked", false);
         });
      }
   });
});
页: [1]
查看完整版本: JQuery实现页面中CheckBox全选