+ 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?
7 Respostas
+ 1
Let the first part of the code be in this form <input type="radio" name="gender" value="male" checked> Male<br>
+ 3
The thing is the code is not actually complete. You will still add value to it.
+ 3
Victor Uwazurike thank you a lot it worked!
+ 3
Make it all in one name and different values
+ 2
am really having tough time learning html. any help guys
+ 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.
+ 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.