What's the point of HTML forms `name` attribute?
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 serve a purpose?
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.
From the specification:
The
name
attribute represents theform
's name within theforms
collection.