Check if any checkboxes are selected in jQuery

Must Read : Check if any checkboxes are selected in jQuery

This checkbox selected function can be easily modified to be used in conjunction with a form submit, as we can see in the JavaScript below. If all checkboxes have been left blank, a ‘Please select at least one checkbox’ alert will appear, otherwise the form will be submitted.

The form tag in your HTML should look something like the below, with the checkChecked function being called on the form’s ‘onsubmit’ trigger.

(Visited 242 times, 1 visits today)

Leave a Comment.