<html>
<head>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
</head>
<body>
<input type="checkbox" name="chk_list"  />1<br />
<input type="checkbox" name="chk_list"  />2<br />
<input type="checkbox" name="chk_list"  />3<br />
<input type="checkbox" name="chk_list"  />4<br />
<input type="checkbox" name="chk_all"  />全选/取消全选
<script type="text/javascript">
$("#chk_all").click(function(){
     $("input[name='chk_list']").attr("checked",$(this).attr("checked"));
});
</script>
</body>
</html>

下面的代码是获取上面实例中选中的checkbox的value值:

<script type="text/javascript">
jQuery--checkbox全选/取消全选 及checkbox遍历 var arrChk=$("input[name='chk_list'][checked]");
    $(arrChk).each(function()jQuery--checkbox全选/取消全选 及checkbox遍历{
       window.alert(this.value);                       
    });
jQuery--checkbox全选/取消全选 及checkbox遍历});
jQuery--checkbox全选/取消全选 及checkbox遍历</script>

相关文章:

  • 2021-12-17
  • 2021-12-26
  • 2022-02-17
  • 2021-12-20
  • 2021-12-24
  • 2022-12-23
  • 2022-02-27
  • 2021-05-24
猜你喜欢
  • 2021-05-27
  • 2022-01-24
  • 2022-12-23
  • 2021-09-07
  • 2021-11-28
相关资源
相似解决方案