mercredi 2 juin 2021

How to check checkbox input with jQuery validation?

I'm trying to check before submitting the form to see if the user has checked the checkbox. I've read a lot of stackoverflow, but I mostly find options for multiple checkboxes. In my case, I have only one checkbox to check. How can i do this? Now I have done this:

jQuery validation:

rules: {
 accept: {
    required: true
   },
  messages: {
    accept: {
      required: "Check the box is required"
     }
 }
}

HTML Markup: <input class="input__custom" type="checkbox" id="accept" name="accept" value="1" > But it doesn't work, please tell me what am I doing wrong?




Aucun commentaire:

Enregistrer un commentaire