今天碰到“jquery动态获取复选框checkbox选中的个数”,首先看下面例子:
复制代码 代码如下:
<input type="checkbox" checked="checked">python<br>
<input type="checkbox" checked="checked">java<br>
<input type="checkbox" >jquery<br>
<input type="checkbox" >phpddt.com<br>
<script src="jquery.js"></script>
<script>
$(function(){
$("input[type='checkbox']").bind("click",function(){alert($("input[type='checkbox'][checked='checked']").length);});
});
</script>
复制代码 代码如下:
<script>
$(function(){
$("input[type='checkbox']").bind("click",function(){alert($("input[type='checkbox']:checked").length);});
});
</script>
新闻热点
疑难解答
图片精选