jquery中checkbox的全选与反选

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>checkbox的全选与反选</title>
<script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
'use strict';

$(function () {
   $("#c1").click(function () {
        $('input[type="checkbox"]').prop("checked", this.checked)
   });

});
</script>
</head>
<body>
<div id="div1">
  <input type="checkbox" id="c1">菜单功能名称<br>
  <input type="checkbox" id="c2" value="2">客户管<br>
  <input type="checkbox" id="c3" value="3">邮件管理<br>
  <input type="checkbox" id="c4" value="4">OA管理<br>
  <input type="checkbox" id="c5" value="5">双呼模块<br>
  <input type="checkbox" id="c6" value="6">事项管理<br>
  <input type="checkbox" id="c7" value="7">系统管理<br />

</div>
</body>
</html>

posted @ 2019-08-22 14:32  澈一  阅读(978)  评论(0编辑  收藏  举报