Test case details

Preparation Code

<script src="//ajax.googleapis.com/ajax/libs/prototype/1/prototype.js"></script> <script src="//ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js"></script> <script src="//ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yuiloader/yuiloader-min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/ext-core/3/ext-core.js"></script> <script src="//www.cinsoft.net/mylib099-min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <div id="formEdit">   <input id="CheckBox1" type="checkbox" name="CheckBox1" checked="checked" /><label for="CheckBox1">1</label> <input id="CheckBox2" type="checkbox" name="CheckBox2" checked="checked" /><label for="CheckBox2">2</label> <input id="CheckBox3" type="checkbox" name="CheckBox3" checked="checked" /><label for="CheckBox3">3</label> <input id="CheckBox4" type="checkbox" name="CheckBox4" /><label for="CheckBox4">4</label> <input id="CheckBox5" type="checkbox" name="CheckBox5" /><label for="CheckBox5">5</label> </div>

Test cases

Test #1

alert($("input:checkbox:checked").length);

Test #2

var vLength = $("input:checkbox").filter(function() {  return $(this).is(":checked"); }).length; alert(vLength);