A Working Example
Below I’m including a working example of looping through all of the input elements on a Web form, and how to isolate and manipulate only specific types of form elements… which in this case involves checkboxes.
The remaining code in the getCheckbox() function splits out the loop and logic into several different lines for legibility. This function gives an example of looping through all of the input element on a Web form, and how to identify form elements that are of a particular type (in this case the checkbox type). Once the function triggers on a checkbox in the loop, an alert is set that outputs the value of the checkbox.
The Example Code