Jquery怎么获得复选框被选中的个数?
想要得到被选中的数量
用循环可以做,需要挨个去判断是否checked
jquery有没有更简单的方法?
[解决办法]
<script src="js/jquery-1.3.2.js"></script>
<script>
function doit(){
alert($("input[name='ChooseOne']:checked").length);
}
</script>
<input type="checkbox" name="ChooseOne" >
<input type="checkbox" name="ChooseOne" >
<input type="checkbox" name="ChooseOne" >
<input type="checkbox" name="ChooseOne" >
<input type="checkbox" name="ChooseOne" >
<input type="button" value="get" onclick="doit()">