<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
<input type="button" value="I like these fruit!">
</div>
alert($("input[type='checkbox']:checked").length)