html
<input type="checkbox" class="group1" value="1" checked="checked" />
<input type="checkbox" class="group1" value="2" />
<input type="checkbox" class="group1" value="3" />
<input type="checkbox" class="group2" value="4" />
<input type="checkbox" class="group1" value="5" checked="checked" />
<input type="checkbox" class="group1" value="6" checked="checked" />
<input type="checkbox" class="group1" value="7" checked="checked" />
<input type="checkbox" class="group1" value="8" />
js
var values = $('input:checkbox:checked.group1').map(function () {
return this.value;
}).get();
alert(values);
获取被选中的数目(类)
js
var valuecount=$('input.group1:checked').length;
alert(valuecount);