Learn HTML Forms by Building a Registration Form - Step 39

Tell us what’s happening:

Hello, I tried using the for attribute and id attribute to link label and input, but it didnt work.

I also did this:

<in’put id=“profile-picture”> <in’put id=“age”> <in’put id=“referrer”> <in’put id=“bio”>Provide a bio:

Didn’t work

and this:

<label <in’put id=“profile-picture”>

and it didn’t work.
I added ’ that so you can see the code above. :confused:
Please help. :frowning:

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Registration Form</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <h1>Registration Form</h1>
    <p>Please fill out this form with the required information</p>
    <form method="post" action='https://register-demo.freecodecamp.org'>
      <fieldset>
        <label for="first-name">Enter Your First Name: <input id="first-name" type="text" required /></label>
        <label for="last-name">Enter Your Last Name: <input id="last-name" type="text" required /></label>
        <label for="email">Enter Your Email: <input id="email" type="email" required /></label>
        <label for="new-password">Create a New Password: <input id="new-password" type="password" pattern="[a-z0-5]{8,}" required /></label>
      </fieldset>
      <fieldset>
        <legend>Account type (required)</legend>
        <label for="personal-account"><input id="personal-account" type="radio" name="account-type" checked /> Personal</label>
        <label for="business-account"><input id="business-account" type="radio" name="account-type" /> Business</label>
      </fieldset>

<!-- User Editable Region -->

      <fieldset>
        <label>Upload a profile picture: <input type="file" /></label>
        <label>Input your age (years): <input type="number" min="13" max="120" /></label>
        <label>How did you hear about us?
          <select>
            <option value="">(select one)</option>
            <option value="1">freeCodeCamp News</option>
            <option value="2">freeCodeCamp YouTube Channel</option>
            <option value="3">freeCodeCamp Forum</option>
            <option value="4">Other</option>
          </select>
        </label>
        <label for="profile-picture" for="age" for="referrer" for="bio"> <input id="profile-picture" id="age" id="referrer" id="bio">
          Provide a bio:
          <textarea> </textarea>
        </label>
      </fieldset>

<!-- User Editable Region -->

      <label for="terms-and-conditions">
        <input id="terms-and-conditions" type="checkbox" required /> I accept the <a href="https://www.freecodecamp.org/news/terms-of-service/">terms and conditions</a>
      </label>
      <input type="submit" value="Submit" />
    </form>
  </body>
</html>
/* file: styles.css */
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
  color: #f5f6f7;
}

label {
  display: block;
  margin: 0.5rem 0;
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

Learn HTML Forms by Building a Registration Form - Step 39

Hi there and welcome to our community!

You have added multiple id attributes to a single input element. Any element should only ever have a single id attribute. You should be adding each of the id attributes above to different input elements.

The same goes for the for attributes. They should be applied to the corresponding label elements (one for attribute to each label element, with each matching the id attribute of the related input element).

2 Likes

One thing to add to what @igorgetmeabrain said,

You can link other elements not only <input> elements to their labels.

The challenge asks you to link your four <label> elements to four elements.

Two of them are <input> elements, one is <select> element and the last is <textarea> element.

2 Likes

Ahhhhhhhhhhhhhhhhhh… Thank you so much you guys! I got it! I really appreciate it :smiley: <3