Cycle through checkboxes on a form and determine if at least one has been checked
Posted on 2004-10-25
I have a form with 3 checkboxes. I need the button to be disabled until the user clicks one of the boxes, at which point it will become enabled. If the user clicks a checkbox, and then clicks again (un-checking it), i need to cycle through all the checkbxes to see whether or not one is still checked in order to set the correct state of the buttons. What I cant figure out is the javacript syntax to check the value of all the checkboxes in a form after an onClick event, or something similar?
<input type="checkbox" value="1">1
<input type="checkbox" value="2">2
<input type="checkbox" value="3">3
<input type="button" disabled value="Go">