Radio Buttons within form tag

Tell us what’s happening:
Hello everyone,
I am getting an error for the outdoor and indoor buttons. I can see it on the website.
However this is the message I am getting
Each of your radio button elements should be added within the form tag.
Any ideas as to where I went wrong.
``

Indoor outdoor ``

Your code so far


<h2>CatPhotoApp</h2>
<main>
  <p>Click here to view more <a href="#">cat photos</a>.</p>
  
  <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
  
  <p>Things cats love:</p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
  <form action="/submit-cat-photo">
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>


<label for="indoor"> 
  <input id="indoor" type="radio" name="indoor-outdoor">Indoor 
</label>

<label for="outdoor"> 
  <input id="outdoor" type="radio" name="indoor-outdoor">outdoor 
</label>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons/

You put your code outsite the tag <form></form>! it should be inside…Put it like this and it should work

<form action="/submit-cat-photo">
    <input type="text" placeholder="cat photo URL" required>
    <label for="indoor"> 
  <input id="indoor" type="radio" name="indoor-outdoor">Indoor 
</label>

<label for="outdoor"> 
  <input id="outdoor" type="radio" name="indoor-outdoor">outdoor 
</label>
    <button type="submit">Submit</button>
  </form>

Your radio buttons are not within the form tag. This is the form tag:

<form>

</form>

Thank you it worked!

1 Like