How to make form of radio type in which only one input is selectable..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to make form of radio type in which only one input is selectable..?

I made html in which i cant fix radio type form Focus on gender option on running it, all options of gender, can be selectd and once you select it you cant unselecet it but i dont want it. I wanted to make it only one selectable.. And can be unselected if any one has to change option.. [ <form> <div>E-mail<br> <input type="email" name="email" placeholder="abc@gmail.com"><br> Password<br> <input type="password" name="password" placeholder="*****"><br> Re-enter password<br> <input type="password" name="password" placeholder="*****"><br></div> <br><div><b>Gender</b><br> <input type="radio">Male <br> <input type="radio">Female <br> <input type="radio">Other<br></div> </form> ] (https://code.sololearn.com/WwvxBNKwsLq8/?ref=app)

9th Oct 2019, 5:41 AM
BlackShadow334
BlackShadow334 - avatar
6 Answers
+ 5
Give them the same name. <br><div><b>Gender</b><br> <input type="radio" name="gender">Male <br> <input type="radio" name="gender">Female <br> <input type="radio" name="gender">Other<br></div>
9th Oct 2019, 5:46 AM
Diego
Diego - avatar
+ 5
Thanx bro. It works
9th Oct 2019, 5:50 AM
BlackShadow334
BlackShadow334 - avatar
+ 4
No it didn't works
10th Oct 2019, 3:59 PM
BlackShadow334
BlackShadow334 - avatar
+ 4
You have to give same name I find it from above ans <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <form id="form" method="get" onsubmit="return v()"> <input type="radio" name="gender">male <input type="radio" name="gender">female<br/> <span id="mess"> </span><br/> <input type="submit"> </form> </body> </html>
10th Oct 2019, 4:00 PM
BlackShadow334
BlackShadow334 - avatar
10th Oct 2019, 9:55 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
+ 3
May it helps
10th Oct 2019, 9:55 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar