2.5 KiB
2.5 KiB
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf08830 | テキストフィールドにプレイスホルダ―テキストを追加する | 0 | https://scrimba.com/p/pVMPUv/cKdJDhg | 16647 | add-placeholder-text-to-a-text-field |
--description--
プレイスホルダ―テキストは、ユーザーが何かを入力する前に input
要素に表示されているテキストです。
次のようにしてプレイスホルダ―テキストを作成できます。
<input type="text" placeholder="this is placeholder text">
注: input
要素は終了タグを持たないことを忘れないでください。
--instructions--
テキストタイプの input
の placeholder
の値に "cat photo URL" を指定してください。
--hints--
既存のテキストタイプの input
要素に、placeholder
属性を追加してください。
assert($('input[placeholder]').length > 0);
placeholder
属性の値を cat photo URL
に設定してください。
assert(
$('input') &&
$('input').attr('placeholder') &&
$('input')
.attr('placeholder')
.match(/cat\s+photo\s+URL/gi)
);
完成した input
要素は終了タグを持たないはずです。
assert(!code.match(/<input.*\/?>.*<\/input>/gi));
完成した input
要素は正しい構文でなければなりません。
assert($('input[type=text]').length > 0);
--seed--
--seed-contents--
<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" 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>
--solutions--
<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" 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>