Counting checked checkboxes in a form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • trettr

    Counting checked checkboxes in a form

    It's possible to count the checked checkboxes in a form ?

    If so, how?


    Bye Raffaele
  • Martin Honnen

    #2
    Re: Counting checked checkboxes in a form



    trettr wrote:
    [color=blue]
    > It's possible to count the checked checkboxes in a form ?
    >
    > If so, how?[/color]

    var formControls = document.formNa me.elements;
    var c = 0;
    for (var i = 0; i < formControls.le ngth; i++)
    if (formControls[i].type.toLowerCa se() == 'checkbox'
    && formControls[i].checked)
    c++;
    alert(c)

    --

    Martin Honnen


    Comment

    Working...