How Add Placeholder Text to a Text Field

How Add Placeholder Text to a Text Field
0.0 0

#1

Tell us what’s happening:

Your code so far


<h2>CatPhotoApp</h2>
<main>
  <p>Click here to view more <a href="this is place holder">cat photos</a>.</p>
  
  <a href=" "><img input type="text" placeholder="this is placeholder text" alt="A cute orange cat lying on its back."></a><input type="text" placeholder="this is placeholder text">
  
  <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>
  <input type="text" placeholder="this is placeholder text">
</main>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36 OPR/53.0.2907.99 (Edition Campaign 34).

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


#2

The href is to give an address for a link, not a placeholder. So this is not the way to do it:

And as the instructions say:

You can create placeholder text like so:
<input type="text" placeholder="this is placeholder text">

Also you don’t need a placeholder on the img element:

Placeholders are for input elements.


#3

in the placeholder attribute you have entered wrong value, instead add “cat photo url”

Placeholder - Placeholder is a text which you will see on a input element before entering any text or value . Placeholder text is descriptive text displayed inside an input field until the field is filled. It disappears when you start typing in the field.