0

So I read the other post about checkbox required attributes but i couldnt get an answer.Other post. It says that i just need to either put the checkbox collection into a DIV or add the "data-grouprequired " attribute to just one checkbox of the group. None of them work. The documentation here says that i just need to add it and it is supposed to require at least one checkbox check. Heres my code

   <html>
   <body>
   <form>
   <input type="checkbox" name="21" value="ff"      onclick="document.getElementById('21a').removeAttribute('required')" data-grouprequired/> </br>
   <input type="checkbox" name="21" value="zz" onclick="document.getElementById('21a').removeAttribute('required')"/>  </br>
   <input type="checkbox" name="21" value="zzf" onclick="document.getElementById('21a').removeAttribute('required')"/> </br>
   <input type="checkbox" name="21" value="afaf" onclick="document.getElementById('21a').removeAttribute('required')"/> </br> 
   <input type="checkbox" name="21" value="tz" onclick="document.getElementById('21a').removeAttribute('required')"></br>
    <input type="checkbox" name="21" value="gaga" onclick="document.getElementById('21a').setAttribute('required', true)" /></br>
   <input type="checkbox" name="21" value="a" onclick="document.getElementById('21a').removeAttribute('required')"/></br>
   <b> Text       </b><input type="text" name="quarter" required ></br>
   <input type="submit">

  </form>
  </body>
  </html>

With this i am not getting the functionality I need. Any ideas? Thanks!

Community
  • 1
  • 1
Kaloyan Dimov
  • 49
  • 1
  • 7
  • check this answer from the other post your are doing in the wrong way http://stackoverflow.com/a/30055382/2488916 – saurabh kamble Dec 18 '15 at 12:24
  • I think the one above that is closer to what i need. With the one you are suggesting I can implement it to work only at button click. With the other one i think it will make it work as the required attribute of a radio group. And also isnt the documentation I link not true ? – Kaloyan Dimov Dec 18 '15 at 12:52

0 Answers0