Error message: "Each of your radio button elements should be added within the form tag."

Error message: "Each of your radio button elements should be added within the form tag."
0

#1

What am I doing wrong here? here is my form code:


Thanks for any and all help.


#2

Can you please post your actual code and not a screenshot? Also, what is the url for this challenge?


#3

The challenge url is:
https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons

<form action="/submit-cat-photo">
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button><p>
    <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>
  </p>
  </form>

#4

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

Question: Why did you put nest the radio buttons in a p element? The challenge did not say to do that.


#5

The radio button ended up next to the submit button, not underneath, which looked sloppy. But removing them seems to have worked, than you.


#6

Thanks for telling me about the backticks.