Nesting Input Elements

Getting error messages and not sure how to correct them:

  1. The existing input element should be nested within a form element.

I don’t know how they aren’t nested, when I have a form element before and after.

  1. Your form should have an action attribute which is set to https://freecatphotoapp.com/submit-cat-photo

I tried it with and without the forward-slash and still get the error message.

  1. Your form element should have well-formed open and close tags.

Same as (1.) I have a form element before and after.

I think it’s also worth noting that the example given doesn’t include the “>” after “<form” and I think that’s why this challenge is giving people so much trouble. Even after correcting that, however, I’m still getting errors.

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="https://freecatphotoapp.com/submit-cat-photo" input type="text" placeholder="cat photo URL">
</form>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15.

Challenge: Create a Form Element

Link to the challenge:

<form action=" ">
<input type=" " placeholder=" ">
</form>
1 Like

Action is an attribute of form tag. Input element is a different tag than form.

Hint: 1. Form element tag needs to be closed after including the action before the input element.
2. Input tag should have <

1 Like

Your code:

<form> action="https://freecatphotoapp.com/submit-cat-photo" input type="text" placeholder="cat photo URL">

  1. The action attribute should be on the starting <form> tag.

  2. The starting <form> tag must be closed > before the next element.

<form action="https://freecatphotoapp.com/submit-cat-photo" >
  1. The input element must have an opening < (less-than sign).
<input type="text" placeholder="cat photo URL" >

If you format your code it’s easier to see:

<form action="/url-where-you-want-to-submit-form-data">
  <input type="text">
</form>
1 Like

Thanks for explaining! I saw some comments on similar posts saying that the tag needed to be closed right after the word “form” even though the example didn’t do that. I thought the example given in the lesson was a typo.

1 Like

Thanks! I wasn’t sure how to format it.