lundi 17 octobre 2016

How to validate multiple checkbox to check atleast one in jquery/javascript?

I have seen many example in this forum for multiple check box validation, but my case is different. i have two set of check box with same name and i want to check at least one in each set.

Here is the code

<div class=main>
  question one here *******?
  <input type="checkbox" name="option[]" />checkbox 1
  <input type="checkbox" name="option[]" />checkbox 2
  <input type="checkbox" name="option[]" />checkbox 3
  <input type="checkbox" name="option[]" />checkbox 4
</div>

<div class=main>
  question two here *******?
  <input type="checkbox" name="option[]" />checkbox 1
  <input type="checkbox" name="option[]" />checkbox 2
  <input type="checkbox" name="option[]" />checkbox 3
  <input type="checkbox" name="option[]" />checkbox 4
</div>

i have tried lot but no luck..any help would be great.




Aucun commentaire:

Enregistrer un commentaire