Radio Input Error [HTML] | Sololearn: Learn to code for FREE!


Radio Input Error [HTML]

I created a radio with male and female values in HTML but the two radios check instead of one... Why? What is the solution?

9/4/2018 4:55:57 PM


3 Answers

New Answer


Anthony Umeh <p>Choose sex</p> <p>Man: <input type="radio" name="sex" /> <br /> Woman: <input type="radio" name="sex" /> </p> check this code


To answer the why part... Giving both radio inputs the same value for the "name" property (as Niket demonstrated) tells the browser to treat them as part of the same group.