โดย mindphp » 25/09/2009 3:50 pm
โค้ด: เลือกทั้งหมด
<script src="jquery.js" type="text/javascript">
function chk_box_count(){
var lenChkBox = $("input:checked").length;
alert(lenChkBox);
}
<script>
<form>
<input type="checkbox" name="chk1" >
<input type="checkbox" name="chk1" >
<input type="checkbox" name="chk1" >
<input type="button" value="Check box count" onclick="chk_box_count()" >
</form>
Jquery นับจำนวน checked box
[code]<script src="jquery.js" type="text/javascript">
function chk_box_count(){
var lenChkBox = $("input:checked").length;
alert(lenChkBox);
}
<script>
<form>
<input type="checkbox" name="chk1" >
<input type="checkbox" name="chk1" >
<input type="checkbox" name="chk1" >
<input type="button" value="Check box count" onclick="chk_box_count()" >
</form>[/code]
Jquery นับจำนวน checked box