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

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

<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="" alt="A cute orange cat lying on its back."></a>

<p>Things cats love:</p>
  <li>cat nip</li>
  <li>laser pointers</li>
<p>Top 3 things cats hate:</p>
  <li>flea treatment</li>
  <li>other cats</li>
<form> action="" input type="text" placeholder="cat photo URL">

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=" ">
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="" 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="" >
  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">
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.