http://www.oschina.net/code/snippet_86510_2781
<!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" οnclick="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一句话实现多选框全选/取消
最新推荐文章于 2018-12-24 20:46:00 发布