HTML:

<input type="checkbox" onclick="boxOnclick(this,'some1')">全选一

<input type="checkbox" onclick="boxOnclick(this,'some2')">全选二

<input type="checkbox" onclick="boxOnclick(this,'some3')">全选三

 

<input type="checkbox" class="some1">全选一的子集

<input type="checkbox" class="some2">全选二的子集

<input type="checkbox" class="some3">全选三的子集

JS:

function boxOnclick(obj, someNum) {

  if (obj.checked) {

    $("." + someNum).each(function () {

      this.checked = true;

    });

  } else {

    $("." + someNum).each(function () {

      this.checked = false;

    });

  }

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-12-13
  • 2021-10-11
  • 2022-12-23
  • 2021-11-17
  • 2022-01-12
猜你喜欢
  • 2022-03-01
  • 2022-02-21
  • 2021-11-01
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案