2.7 KiB
2.7 KiB
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
bad87fee1348bd9aedf08830 | Add Placeholder Text to a Text Field | 0 | https://scrimba.com/p/pVMPUv/cKdJDhg | 16647 | Добавить текст для placeholder в текстовое поле |
Description
input
до того, как ваш пользователь ввел что-либо. Вы можете создать текст placeholder'а следующим образом: <input type="text" placeholder="this is placeholder text">
Instructions
placeholder
вашего input
текста «URL-адрес кота».
Tests
tests:
- text: Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.
testString: assert($("input[placeholder]").length > 0);
- text: 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>