jquery中checkbox的全选与反选

<script type="text/javascript">
'use strict';

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

});

</script>

<body>
<div id="div1">
<input type="checkbox" id="c1">菜单功能名称<br>
<input type="checkbox" id="c2">客户管理<br>
<input type="checkbox" id="c3">邮件管理<br>
<input type="checkbox" id="c4">OA管理<br>
<input type="checkbox" id="c5">双呼模块<br>
<input type="checkbox" id="c6">事项管理<br>
<input type="checkbox" id="c7">系统管理<br />

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

猜你喜欢

转载自www.cnblogs.com/zjbd/p/11394155.html