Learn HTML Forms by Building a Registration Form - Step 18

I added the input element with a for attribute. Hint: The first label element should have a for attribute with a value of first-name. I didn’t see any other posts for this. I know I will have to mirror the same for the other labels.

      <fieldset>
        <label>Enter Your First Name: <input id="first-name" for="first-name"</label>
        <label>Enter Your Last Name: <input id="last-name"/></label>
        <label>Enter Your Email: <input id="email"/></label>
        <label>Create a New Password: <input id="new-password"/></label>
      </fieldset>

A label is not an input.
The for attribute belongs in the label, not the input.

Thanks for the tip. I moved the for attribute outside of the input element. Hint: The first label element should have a for attribute with a value of first-name. When I try and write the code here, it doesn’t show up.

I can’t see your code. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

@hbar1st thank you for the information. I have added the updated code. The for attribute is not in the input element. It doesn’t look right. Not completely understanding the for attribute: for=“value”>Value

<label>Enter Your First Name: <input id="first-name"/> for="first-name"</label>

literally cut the text of the for attribute out and place it right next to the word label (with one space in between) inside the <label> tag please.

@hbar1st, thank you for your time and patience. I understand now.

1 Like