Check If One Checkbox Is Checked

/ Published in: jQuery
Save to your folder(s)

Copy this code and paste it in your HTML
  1. $("#formId").submit(function(){
  2. var checked = $("#formId input:checked").length > 0;
  3. if (!checked){
  4. alert("Please check at least one checkbox");
  5. return false;
  6. }
  7. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.