Is it valid to have two input elements with the same name?

前端 未结 6 1131
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 11:40

i.e.:

and

6条回答
  •  天命终不由人
    2020-12-13 12:16

    Yes -- each will only submit with their respective forms.

    If you have them in the same form, one will override the other and it is not valid.

    EDIT: As pointed out by Mahmoodvcs that the overriding only occurs in some languages (such as PHP) as is not inherent within HTML itself.

提交回复
热议问题