I have multiple checkboxes on a page, generated with PHP. How would I go about creating a javascript script that would disable a button if NONE of the checkboxes are clicked, and enable the button if even ONE of the boxes are clicked? I'm brand new to Javascript, so I'm sure this is relatively easy, but any help would be so greatly appreciated.
Here's what I have so far, but this only works for one checkbox, and not multiple.
Javascript:
function terms_changed(termsCheckBox){
if(termsCheckBox.checked){
document.getElementById("submit_button").disabled = false;
} else{
document.getElementById("submit_button").disabled = true;
}
}
HTML:
<form method="post">
<div>
<input type='checkbox' name='uuid[]' value=1 id=1 onclick="terms_changed(this)"/>
<input type='checkbox' name='uuid[]' value=2 id=2 onclick="terms_changed(this)"/>
<input type='checkbox' name='uuid[]' value=3 id=3 onclick="terms_changed(this)"/>
/// plus countless others, you get the idea ///
</div>
<div>
<button type="submit" id="submit_button" disabled>Sign Up</button>
</div>
</form>