读书人

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

发布时间: 2012-03-30 17:32:09 作者: rapoo

Jquery怎么获得复选框被选中的个数? - Web 开发 / Ajax
想要得到被选中的数量
用循环可以做,需要挨个去判断是否checked
jquery有没有更简单的方法?

[解决办法]

HTML code
<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来实现吧

接分咯

读书人网 >Ajax

热点推荐