Learn HTML Forms by Building a Registration Form - Step 33

the hint is saying You should nest only the select element within a label element. but i have the label element nested in the select element someone pls tell me if i’m wrong and help me pls this community has so helpful on my last post my code is below and challenge is linked as well

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 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>
        <label for="personal-account"><input id="personal-account" type="radio" name="account-type" /> Personal Account</label>
        <label for="business-account"><input id="business-account" type="radio" name="account-type" /> Business Account</label>
        <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>
      </fieldset>
      <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?</label>
         <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>
      </fieldset>
      <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 (X11; CrOS aarch64 14989.107.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Learn HTML Forms by Building a Registration Form - Step 33

Link to the challenge:

Hi!
Very good job, it’s correct only that you was a bit early with the closing label tag.
It says that you should nest the select element within a label element.
When you nest something, it should come in between the opening and closing tags.
Hope this helped!

so the select element needs to come in between the closing and opening tags of the labels tags

ok i got the tags now its says You should give the label element the text How did you hear about us? . but i already have that in the select tag the test is confusing me

If you look at the code in this page that you posted first time, you see how that text come between label that is correct.
You need to put the select inside label but after that text.
For example, text>select element.

1 Like

bruh its still giving me the same error even when i put the select tag in the label tag after and before the text

Hi, please could you post your code again?

1 Like

the first one or the one i have now

<label><select>How did you hear about us?</select></label>
           <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>

here’s the code i have now

Hi, you should omit the select tag that is before and after the text.
And the closing label tag and everything should be okey.

1 Like

hello again your solution is not working i removed both the select tags before and after the text and removed and ITS STILL GIVING ME A ERROR THAT SAYS You should give the label element the text How did you hear about us? . i have that text in the code and its still gives me this darn error

 <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>

here’s the code if you want to look over it again

dear,
reset the code and try again.
then it might work.

i reseted it and it still did not work

now it worked thank you so much i have been stuck on this error for a 6 days thxs so much

you seem to have an extra space to the left of the word How
pls remove that and retry

1 Like

thank you so much i’m glad this community is helpful

1 Like