How to validate a form with multiple checkboxes to have atleast one checked

前端 未结 11 808
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 23:40

I\'m trying to validate a form using the validate plugin for jquery. I want to require that the user check at least one checkbox in a group in order for the form to be sub

11条回答
  •  甜味超标
    2020-12-01 00:11

      $('#subscribeForm').validate( {
          rules: {
              list: {
                  required: true,
                  minlength: 1
              }
           }
       });
    

    I think this will make sure at least one is checked.

提交回复
热议问题