Html radio button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Html radio button

Why? While using radio button in html i can select both the option, but the property of radio button states it can select only one option why is it happening?

29th Apr 2018, 7:14 AM
Ayush Tripathi
3 Answers
+ 2
Ayush Tripathi, you will have to add the radio buttons in a Button Group. It is a characteristic property of RadioButtons in both Java and HTML, until it is in a ButtonGroup. You can use the following to create a group: <div class="btn-group"> <button>Name</button> <button>Class</button> <button>Rollno</button> </div> OR <form> <input type="radio" name="btn-grp" value="Name" checked> Name<br> <input type="radio" name="btn-grp" value="Class"> Class<br> <input type="radio" name="btn-grp" value="Rollno"> Rollno </form> Make sure to have the same name(Here btn-grp).
29th Apr 2018, 7:21 AM
Jemuel Stanley
Jemuel Stanley - avatar
+ 3
then maybe youre declaring several seperate radios thinking they are linked together
29th Apr 2018, 7:21 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 2
If you link your code, i would be happy to have a look and help out where i can
29th Apr 2018, 12:17 PM
Memphis Reigns
Memphis Reigns - avatar