Just wondering, and this may become apparent in later lectures, but when referring to specific form inputs Mosh creates a brand new property called Name which is named the same as ID.
Is there a reason he doesn’t just use the existing ID property?
Just wondering, and this may become apparent in later lectures, but when referring to specific form inputs Mosh creates a brand new property called Name which is named the same as ID.
Is there a reason he doesn’t just use the existing ID property?
Form data is submitted as a set of name value pairs. So for example when this form is submitted…
<form action="http://localhost:3000" method="POST">
<input id="some-id" name="some-name" type="text">
<input type="submit" value="Click to Submit">
</form>
The following form data is submitted to the server…
some-name=testing
The name
attribute is used as the name of the name value pair. And without a name
attribute, the data isn’t submitted at all.