首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

Jquery如何获得复选框被选中的个数

2013-01-06 
Jquery怎么获得复选框被选中的个数?想要得到被选中的数量用循环可以做,需要挨个去判断是否checkedjquery有

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()">


[解决办法]
简单的还是用js来实现吧

接分咯

热点排行