2.根据type="checkbox"选中所有checkbox

const checkList = document.querySelectorAll('input[type="checkbox"]');

3.修改checkbox选中状态

// 选中
document.querySelector('input[type="checkbox"]').checked = true;
// 取消选中
document.querySelector('input[type="checkbox"]').checked = false;

4.获取checkbox的value

const curValue = document.querySelector('input[type="checkbox"]').value;

文章来自:https://www.jianshu.com/p/ea583ec4fb82

相关文章:

  • 2022-01-10
  • 2021-09-21
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2021-07-04
  • 2021-06-18
  • 2021-06-12
  • 2022-12-23
  • 2021-08-26
  • 2021-12-04
  • 2021-07-23
相关资源
相似解决方案