What's the point of HTML forms `name` attribute?

后端 未结 6 1807
情歌与酒
情歌与酒 2020-12-05 09:01

What\'s the point of the name attribute on an HTML form? As far as I can tell, you can\'t read the form name on submission or do anything else with it. Does it

6条回答
  •  感动是毒
    2020-12-05 09:42

    In short, and probably oversimplifying a bit: It is used instead of id for browsers that don't understand document.getElementById.

    These days it serves no real purpose. It is a legacy from the early days of the browser wars before the use of name to describe how to send control values when a form is submitted and id to identify an element within the page was settled.

提交回复
热议问题