Why all related radio buttons should have the same name attribute???
Radio buttons are grouped in a way that you should only be able to select one button from a group. You donât want people to select âboyâ, âgirlâ, AND âcomplicatedâ from a gender field (⌠which is a terrible thing to ask anyway in todayâs world. Only hospitals and the like actually NEED to know gender).
The name attribute is how the browser knows that these radio buttons are related. Different groups of radio buttons can have different names so they donât interfere with each other. Without name, your âpreferred in-flight mealâ group could interfere with your âgenderâ group.
Also, radio buttons donât toggle; you canât turn the off after you turn them on (for that, you should be using a checkbox instead). In order to turn one radio button in a group off, you need to turn another on.
That makes more sense.
THANKS.