js 全选全不选

来我群吧java-web交流群:132607763

<html>
<head>
	<title>input</title>
	<script type="text/javascript" src="jquery.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#checkall').click(function() {
				$("input[type='checkbox']").attr('checked',$('#checkall').is(':checked'));
			});
		});
	</script>
</head>
<body>
	<form id="signup" method="post" action="">
		<div><input type="checkbox" id="checkall">Ckeck/Unckeck all checkboxes</div>
		<div><input type="checkbox" id="pizza" value=5>Pizza</div>
		<div><input type="checkbox" id="hotdog" value=3>hotdog</div>
		<div><input type="checkbox" id="cake" value=2>cake</div>
		<div><input type="checkbox" id="fries" value=1>french fries</div>
	</form>
</body>
</htmL>

你可能感兴趣的:(jquery,全选,全不选)