How to lock an option (form attributes) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to lock an option (form attributes)

Hello guys, currently i am learning about forms in HTML. When i tried to code this way: <form> <input type="radio" gender="name" value="male"/> Male <br /> <input type="radio" gender="name" value="female"/> Female <br /> </form> I found out that both options can be checked -- Male & Female. Is there a way to prevent that? So we can chose only either Male or Female. Thank you.

22nd Oct 2017, 2:04 PM
Paul Brugman
Paul Brugman - avatar
3 Answers
+ 3
You reversed part of it. that otta be: name="gender" And the rest is correct.
28th Jan 2018, 2:49 PM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
+ 2
<input type="radio" name="gender" value="male" />Male <br /> <input type="radio" name="gender" value="female" />Female <br />
22nd Oct 2017, 2:32 PM
Kathi Sai Prathap
Kathi Sai Prathap - avatar
0
Ah, i got it. Wrong attributes. Thank you.
22nd Oct 2017, 3:14 PM
Paul Brugman
Paul Brugman - avatar