In a form, I have some checkboxes, these:
<div class="form-group ">
<label for="inputName" class="col-lg-2 control-label ">Assistants</label>
<div class="col-lg-4">
<div class="checkbox">
<label><input type="checkbox" name="helper2" value="0">name1</label>
<label><input type="checkbox" name="helper2" value="1">name2</label>
<label><input type="checkbox" name="helper2" value="2">name3</label>
</div>
</div>
</div>
and then my submit button:
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="submit" class="btn btn-primary" id="postme">Submit</button>
</div>
</div>
and I want the user to check at least 1 checkbox, otherwise the submit button doesn't work. I have found many solutions where one checkbox have to checked but i can't customize it here where I have many checkboxes.. Here is a try...
I dont know what exactly you are expecting,but the following code detects if any 1 one of the checkbox are checked,it returns false if none are checked.
P.S:I am using a button with id of
button-id
, you can use this code on form submit.