Count number of checked checkboxes
Count the number of checked checkboxes in a form.
1. function doCount(f) {
2. var j = 0;
3. for ( i = 0 ; i < f.length; i++ ) {
4. if ( ( f[i].type == "checkbox" ) && ( f[i].checked ) ) {
5. j++;
6. }
7. }
8. return j;
9. }
10.
11. doCount(document.forms.formName);
Comments
Posted by: steven around 18 Months AgoThis is exactly what I needed!