<!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" >
<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>