checked

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="jquery.js"></script>

</head>
<body>
<div>
<input type="checkbox" name="fruit"> apple
<input type="checkbox" name="fruit"> orange
<input type="checkbox" name="fruit"> banana
<input type="checkbox" name="fruit"> watermelon<br>
<input type="button" value="I like these fruit!">
</div>

<script>
$(function(){
$("input[type='button']").click(function() {
alert($("input[type='checkbox']:checked").length);
});
})

</script>
</body>
</html>

posted on 2016-06-27 21:17  uman  阅读(162)  评论(0编辑  收藏  举报

导航