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: The Label

I am a little confused as to why this code is not working to place the cursor in the textbox if I click on the label. I am using a current version of chrome if that matters.

  <form action="index.html" method="post">
    <h1>Sign Up</h1>
    <label for="name">Your Name:</label>
    <input type="text" id=”name” name=”user_name”>
    <label for=’mail’>Email Address:</label>
    <input type="email" id="mail" name="user_email">
    <label for=’password’>Password:</label>
    <input type="password" id="password" name="user_password">
    <textarea id=”txtID” name=”user_bio”></textarea>
    <button type=”submit”>Sign Up</button>
  </form>

2 Answers

Hi,

The problem is about the single and double quotations. If you look carefully take for example input field name, and label mail. They are not using correct quotes. You should correct them as follows:

<form action="index.html" method="post">
  <h1>Sign Up</h1>
  <label for="name">Your Name:</label>
  <input type="text" id="name" name="user_name">
  <label for='mail'>Email Address:</label>
  <input type="email" id="mail" name="user_email">
  <label for='password'>Password:</label>
  <input type="password" id="password" name="user_password">
  <textarea id="txtID" name="user_bio"></textarea>
  <button type="submit">Sign Up</button>
</form>

End of course do not use single quotes..

Hi David, I tested your code, and this works well. If you inspect element, you'll see that quotations are auto-corrected, but you should definitely be consistent using quotations. It is good practice, and it's easier for you and for people working on your code. If you asked about textarea, you just don't have a label for that. All you need is label tag with for attribute:

<label for="txtID">Your bio:</label>
<textarea id="txtID" name="user_bio"></textarea>