This is probably because you're giving all of the
<input>
elements the same
id
. The
HTML - The id attribute[
^] is supposed to be unique on a web-page, so having a
<label>
with a
for
attribute for an
id
that isn't unique is going to behave strangely (I think browsers might handle this scenario differently).
Just give each input a unique
id
attribute value and change the corresponding
for
attribute value in the label. This could be done by appending a number or index (ie. if it's in a table, you could append the
id
with the row number of the table.)