Files
freeCodeCamp/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.english.md
Randell Dawson 9bf3fdbf38 fix(curriculum): changed challenge test text to use the word should for Responsive Web Design (#36860)
* fix: changed challenge test text to use should

* fix: changed have to be used in

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: reworded test verbiage

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: improved test verbiage

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: improved test verbiage

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: corrected typo

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: corrected typo

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: changed have the to be used in

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: corrected verbiage

Co-Authored-By: Parth Parth <34807532+thecodingaviator@users.noreply.github.com>
2019-11-20 20:15:19 +05:30

2.5 KiB

id, title, challengeType, videoUrl, forumTopicId
id title challengeType videoUrl forumTopicId
bad87fee1348bd9aedf08830 Add Placeholder Text to a Text Field 0 https://scrimba.com/p/pVMPUv/cKdJDhg 16647

Description

Placeholder text is what is displayed in your input element before your user has inputted anything. You can create placeholder text like so: <input type="text" placeholder="this is placeholder text">
Note: Remember that input elements are self-closing.

Instructions

Set the placeholder value of your text input to "cat photo URL".

Tests

tests:
  - text: You should add a <code>placeholder</code> attribute to the existing text <code>input</code> element.
    testString: assert($("input[placeholder]").length > 0);
  - text: You should set the value of your placeholder attribute to "cat photo URL".
    testString: assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi));
  - text: The finished <code>input</code> element should not have a closing tag.
    testString: assert(!code.match(/<input.*\/?>.*<\/input>/gi));
  - text: The finished <code>input</code> element should have valid syntax.
    testString: assert($("input[type=text]").length > 0);

Challenge Seed

<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>
  <input type="text">
</main>

Solution

<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>
  <input type="text" placeholder="cat photo URL">
</main>