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 Choosing Options Create Radio Buttons

highpriestess
highpriestess
5,486 Points

I need help with a code challenge.

I think something is wrong here. It says that I'm supposed to add a label above the radio button group that says 'Shirt Size'. I typed what's below and it says that it's wrong. I'm stumped. Isn't this a label?

<label> Shirt Size:</label>
        <input type="radio" id="small" value="small" name="shirt_size">
        <label for="small">Small</label>
        <input type="radio" id="medium" value="medium" name="shirt_size">
        <label for="medium">Medium</label>
        <input type="radio" id="large" value="large" name="shirt_size">
        <label for="large">Large</label>

Hi High, I markdown your code so others can see it better. You can check the video on the right to learn how to do that as well :)

4 Answers

Doesn't seem to be anything wrong with your code. I remember having problems with this challenge myself. However, I've just gone through and copied and pasted the code you supplied and it worked for me.

You could try replacing everything with the code below and see if works this time (not sure why it would make any difference but worth a shot):

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>HTML Forms</title>
  </head>
  <body>
    <form action="index.html" method="post">
      <h1>Shirt Order Form</h1>
      <label for="color">Shirt Color:</label>
      <select id="color" name="shirt_color">
        <option value="red">Red</option>
        <option value="yellow">Yellow</option>
        <option value="purple">Purple</option>
        <option value="blue">Blue</option>
        <option value="green">Green</option>
        <option value="orange">Orange</option>
      </select>
        <label>Shirt Size:</label>
        <input type="radio" id="small" value="small" name="shirt_size">
        <label for="small">Small</label>
        <input type="radio" id="medium" value="medium" name="shirt_size">
        <label for="medium">Medium</label>
        <input type="radio" id="large" value="large" name="shirt_size">
        <label for="large">Large</label>


      <button type="submit">Place Order</button>
    </form>
  </body>
</html>

Let us know if you're still having problems.

highpriestess
highpriestess
5,486 Points

James,

That code did the trick.

Weird.

Thank you to everyone who responded.

The only thing I can suggest is look at your name, id, and value parameters and make sure those are correct...

Hi again High, I suggest you check out this previous answer about putting the labels next to the input type. Check it out here