Radio button validation in form | Sololearn: Learn to code for FREE!


Radio button validation in form

Can anyone tell me how can I validate radiobutton for gender in form validation

8/31/2020 5:16:53 PM


3 Answers

New Answer


There is nothing to validate for radio buttons on forms since only one can be selected and any single selection is valid. The easiest way to do this is to auto select a default value by using the checked attribute e.g. <input type="radio" name="gender" value="male" checked>Male If the user does not change the default value then the entry is still valid. See... HTML5 form controls have the ability to validate themselves without the need for JavaScript. See...


If the name for all radio will be same you can select only one out of them.