Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need some help on validating the below code in javascript

I would like to validate the below code in js so that the user has to check one but i do not know how to. The form name is 'registration'

<li>
   <input type="checkbox" name="en" value="en"  />
   <span>English</span>
</li>
<li>
   <input type="checkbox" name="nonen" value="noen" />
   <span>Non English</span>
</li>   
like image 529
zaniku Avatar asked Dec 14 '22 07:12

zaniku


1 Answers

Use an input of type radio instead. Here is a link to the MDN documentation, basically all inputs of type radio that have the same name property are grouped together and the user can select only one of them. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio

like image 92
Gabriel Lupu Avatar answered Mar 04 '23 05:03

Gabriel Lupu