今天碰到“jquery動態(tài)獲取復(fù)選框checkbox選中的個數(shù)”,首先看下面例子:
復(fù)制代碼 代碼如下:
<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>
復(fù)制代碼 代碼如下:
<script>
$(function(){
$("input[type='checkbox']").bind("click",function(){alert($("input[type='checkbox']:checked").length);});
});
</script>
新聞熱點
疑難解答
圖片精選