您的位置:首页 > Web前端 > JQuery

jQuery一句话实现多选框全选/取消

2012-02-16 21:58 591 查看
<!DOCTYPE Html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
function selectAll(checkbox) {
$('input[type=checkbox]').attr('checked', $(checkbox).attr('checked'));
}
</script>
</head>
<body>
<input type="checkbox" onclick="selectAll(this);" />全选<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/>
……
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jquery input function