<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>全选反选</title>
<script src="jquery.min.js"></script>
<script>
function checkAll(obj){
$("#box input[type='checkbox']").prop('checked', $(obj).prop('checked'));
}
</script>
</head>
<body>
<div class="test" style="width: 500px;text-align: center;" >
<div id="box">
<input type="checkbox" οnclick="checkAll(this)">全选<br><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
</div>
</div>
</body>
</html>
jquery实现checkbox全选和反选
最新推荐文章于 2021-09-12 17:38:00 发布