HELP - Step 18 Learn HTML Forms by Building a Registration Form

I recently completed the Registration Form project. I was a little confused with the instructions regarding value pairing between labels and inputs. It was my understanding that we link labels and inputs using the for/name attributes. However the instructions below advise on linking these elements using for/id. These types of instructions are repeated a few times throughout the course with other label/input elements.

When reading the html documentation, it re-affirmed that the name attribute is what should be used to connect data submission functionality within a form. So please help me understand why in this lesson we pair for with id instead of name. (note: we are asked later on to add name attributes to all of the input elements, but there is no requirement to ensure they match the for attribute…)

Following accessibility best practices, link the input elements and the label elements together using the for attribute.

Use first-name, last-name, email, and new-password as values for the respective id attributes.

the name attribute is for the submiting functionality.
The for/id pair for label/input elements is to allow the label to be linked to the input in the page, like for example you can click on the label to put focus on the input, it’s an accessibility thing.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.