view raw
Nick Pocock Nick Pocock - 11 months ago 49
HTML Question

Only allow one radio button to be checked HTML

I have a series of radio buttons in which i'd only like 1 to be able to be selected. I have them all with the same name so I thought this would do the trick but i can still select all four.


<input type="radio" name="portion_num" value="2" /> Two

<input type="radio" name"portion_num" value="4" /> Four

<input type="radio" name"portion_num" value="6" /> Six

<input type="radio" name"portion_num" value="8" /> Eight


The reason it doesn't work is because your name attribute syntax is wrong.

name"portion_num" should be name="portion_num"