0
Why radio input is not working?
It's supposed that you can only choose one answer when using this <input type ="radio"> why mine isn't working? https://sololearn.com/compiler-playground/WT3uHa59uhUu/?ref=app
4 Answers
+ 8
Hi Elina,
You need to add the name attribute to each radio button in the group.
If you add name="1" after the id value for each radio button it will group them together and only 1 can be selected.
It will look like this:
<input type="radio" id="d" name ="1">
<label for="d">Male</label><br>
<input type="radio" id="f" name="1">
<label for="f">Female</label>
+ 2
StuartH thanks đ now I fixed it
+ 1
Hey give same name in both radio so that only one is selected at a time
+ 1
Hritik Sharma Thanks đ