给每个复选框添加click事件或者change事件,例如
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<script src="
http://code.jquery.com/jquery-1.11.3.min.js"></script><script src="
http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script><style>
.div{
width:200px;
height:200px;
border:2px solid red;}
</style>
<script>
$(function(){
$("input").bind("click",function(){
if(this.checked){
$("#"+$(this).attr("traget")).hide();
}else{
$("#"+$(this).attr("traget")).show();
}
})
});
</script>
<body>
<input type="checkbox" id="id1" traget="div1">
<label for="id1">div1</label>
<input type="checkbox" id="id2" traget="div2">
<label for="id2">div2</label>
<input type="checkbox" id="id3" traget="div3">
<label for="id3">div3</label>
<br/>
<br>
<div class="div" id="div1">div1</div>
<div class="div" id="div2">div2</div>
<div class="div" id="div3">div3</div>
</body>
</html>