2.3 KiB
2.3 KiB
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf08830 | Adicionar texto placeholder a um campo de texto | 0 | https://scrimba.com/p/pVMPUv/cKdJDhg | 16647 | add-placeholder-text-to-a-text-field |
--description--
O texto placeholder é o conteúdo exibido dentro do elemento input
antes da inserção de texto por parte do usuário.
Você pode criar um texto placeholder da seguinte maneira:
<input type="text" placeholder="this is placeholder text">
Observação: lembre-se de que os elementos input
fecham em si mesmos.
--instructions--
Defina o valor do placeholder
do elemento input
de texto para "cat photo URL".
--hints--
Você deve adicionar um atributo placeholder
ao elemento input
de texto que já existe.
assert($('input[placeholder]').length > 0);
Você deve definir o valor do atributo placeholder
para cat photo URL
.
assert(
$('input') &&
$('input').attr('placeholder') &&
$('input')
.attr('placeholder')
.match(/cat\s+photo\s+URL/gi)
);
O elemento input
final não deve ter uma tag de fechamento.
assert(!code.match(/<input.*\/?>.*<\/input>/gi));
O elemento input
final deve ter uma sintaxe válida.
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://www.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>
--solutions--
<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img src="https://www.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>