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!

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

where am i going wrong

im getting a bummer

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:</label>
    </form>

  </body>
</html>

3 Answers

What Dan Oswalt said it's wrong. A part of it it's wrong.

the for attribute is equal to the Input ID attrtibute. So your input id is name. The correct way is this:

 <label for="name">Name:</label>

Now you should put the label element before the input element. like this:

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

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

  </body>
</html>

Sorry! Should have looked closer at the question.

thanx it worked out

ok thanx Dan

Your code is messed up here:

<label>for=">Name:</label>

This should be written

<label for="Name:"></label>

still im getting a bummer:

Bummer! You need to set the 'for' attribute to "name".