+ 1

Could someone tell me please how does the code below allow the user to choose BOTH male & female together at once?!

<input type="radio" value="male" name="male">male<br/> <input type="radio" value="female" name="female">female<br/> my Q is how can i make it to choose only one option at a time?

1st Jan 2019, 9:03 PM
RiGeL
RiGeL - avatar
7 Réponses
+ 1
Let the first part of the code be in this form <input type="radio" name="gender" value="male" checked> Male<br>
1st Jan 2019, 9:20 PM
Victor Uwazurike
Victor Uwazurike - avatar
+ 3
The thing is the code is not actually complete. You will still add value to it.
1st Jan 2019, 9:05 PM
Victor Uwazurike
Victor Uwazurike - avatar
+ 3
Victor Uwazurike thank you a lot it worked!
1st Jan 2019, 9:31 PM
RiGeL
RiGeL - avatar
+ 3
Make it all in one name and different values
3rd Jan 2019, 3:04 AM
Ambele Newton
Ambele Newton - avatar
+ 2
am really having tough time learning html. any help guys
8th Jan 2019, 12:30 PM
jackson Asare
+ 1
try this too: <form> <input type="radio" name="sex" value="male" checked>Male <br> <input type="radio" name="sex" value="female">Female </form> for clarification, your code did not work because you didn't indicate which radio button would be set as checked.
2nd Jan 2019, 11:59 PM
Adediji David
Adediji David - avatar
+ 1
The difference is the Name attribute. If there are two options with the same Name then only one can be chosen. Set the Name of these both to "gender" and it should behave like you want.
9th Jan 2019, 11:05 AM
Josh Lagerwey