<input type="text" required>

Tell us what’s happening:

“Your text input element should have the required attribute.” This is what I have been getting, I wonder what I have been doing wrong?

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">
    <button type="submit">Submit</button>
    <input type="text" required>
 
 
 </form>

</main>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:51.0) Gecko/20100101 Firefox/51.0.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field

You have another text input element that needs the required attribute.

Thank you for your prompt response. can you please be more specific? as you can see, this is my first coding. Thank you again.

So if you look at what the challenge wants, it wants you to add the required attribute to the already existing input element of the type=“text”. What you did is: You added a new input element with the text type and also the required attribute. So reset your code look in the form element for an input element of the type text and add the required attribute to that element. I hope this helps :slight_smile:

<form action="/submit-cat-photo">

<input type="text" placeholder="cat photo URL">

<button type="submit"> ;Submit </button>

</form>
1 Like

Thank you for your time again. you are right, your response relates to the previous challenge. The following challenge is to “Make your text input a required field, so that your user can’t submit the form without completing this field.”
I tried this:

It didn't work.

you have duplicated the input field, don’t create a new one, modify the one that exists by adding “required”

1 Like

i can’t see what you tried.
Original code from the challenge:

<form action="/submit-cat-photo">

<input type="text" placeholder="cat photo URL">

<button type="submit"> Submit </button>

</form>

After adding the required attribute:

<form action="/submit-cat-photo">

<input type="text" placeholder="cat photo URL" required>

<button type="submit"> Submit </button>

</form>

To add the required statement to the input element you have to type it into the element.

1 Like

Thank you both so much. I got it.