Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Forms Organizing Forms Add Labels

User name attribute not working correctly.

My user attribute is not working correctly. I believe I have done what the exercise has requested. Can anybody give me the correct code? Thank you

index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>HTML Forms</title>
  </head>
  <body>

    <form action="index.html" method="post">
      <input type="text" id="name" name="user_name">
      <textarea id="comment" name="user_comment"></textarea>
      <button type="submit">Submit Comment</button>

      <label for="name">Name:</label>
      <label for="comment"> Comment: </label> 
      <label for="email">

      <input type="email">



      <textarea>

    </form>

  </body>
</html>

3 Answers

Hi Avery,

You have most of the code you need to pass the challenge. All you really need to do is finish the <input> tag for email by including the id and name attribute after the type attribute.

Then, you should close your email label with the closing tag, </label>.

Finally, you can delete the <textarea> tag above the </form> tag since there is no closing tag in your code for textarea here and it is not required for the task.

Cheers!

Thank you, I have tried to add the id attribute to "name" and "email" each time I switch, it tells me to switch it back to the other.

Bummer: You need to set the id attribute to "email". Bummer: You need to set the input id attribute to "name".

Hi Avery,

Hmmm...a visual picture may help guide you since you didn't paste your code with the error you received. Take a look at this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>HTML Forms</title>
  </head>
  <body>

    <form action="index.html" method="post">
      <input type="text" id="name" name="user_name">
      <textarea id="comment" name="user_comment"></textarea>
      <button type="submit">Submit Comment</button>



    <label for="name">Name:</label> 
        <label for="comment">Comment:</label>
        <input type="email" id="email" name="user_email">
        <label for="email">Email:</label>




    </form>

  </body>
</html>

I was able to pass the entire challenge with those four lines. Try that and let me know if you have any other problems.

Cheers!

Alright, I need to create a new label and a new input.