您的位置:首页 > 编程语言

多选框全选全不选代码

2016-03-26 09:31 363 查看
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-2.2.2.js"></script>
<script language="JavaScript">
$(function(){
$("#qx").click(function(){
if($(this).prop('checked')){
$("input").prop('checked',true);
}else{
$("input").prop('checked',false);
}
})
})
</script>
</head>
<body>
<input type="checkbox" id="qx"/><label for="qx">全选</label>
<input type="checkbox" id="read"/><label for="read">阅读</label>
<input type="checkbox" id="sport"/><label for="sport">运动</label>
<input type="checkbox" id="sleep"/><label for="sleep">睡觉</label>
<input type="checkbox" id="swim"/><label for="swim">游泳</label>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jquery