2.8 KiB
id | title | challengeType | dashedName |
---|---|---|---|
5ef9b03c81a63668521804db | Passo 40 | 0 | step-40 |
--description--
Para evitar que um usuário envie o formulário quando as informações necessárias estiverem faltando, você precisa adicionar o atributo required
a um elemento input
. Não há a necessidade de definir um valor para o atributo required
. Em vez disso, apenas adicione a palavra required
(obrigatório) ao elemento input
, certificando-se de que haja um espaço entre esse atributo e os outros.
--hints--
Você excluiu o elemento input
ou ele tem uma sintaxe inválida. Os valores de todos os atributos devem estar cercados com aspas.
assert($('input').length);
O elemento form
deve conter apenas o elemento input
. Remova os elementos HTML ou o texto adicionais do elemento form
.
assert(
$('form')[0].children.length === 1 &&
$('form')[0].innerText.trim().length === 0
);
O elemento input
deve ter o atributo required
. Lembre-se: você deve apenas adicionar a palavra required
dentro da tag do elemento input
.
assert($('input')[0].hasAttribute('required'));
Não deve ser dado algum valor para o atributo required
.
assert($('input')[0].getAttribute('required') === '');
--seed--
--seed-contents--
<html>
<body>
<h1>CatPhotoApp</h1>
<main>
<section>
<h2>Cat Photos</h2>
<!-- TODO: Add link to cat photos -->
<p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
<a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
</section>
<section>
<h2>Cat Lists</h2>
<h3>Things cats love:</h3>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<figure>
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate.">
<figcaption>Cats <em>love</em> lasagna.</figcaption>
</figure>
<h3>Top 3 things cats hate:</h3>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<figure>
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg" alt="Five cats looking around a field.">
<figcaption>Cats <strong>hate</strong> other cats.</figcaption>
</figure>
</section>
<section>
<h2>Cat Form</h2>
<form action="https://freecatphotoapp.com/submit-cat-photo">
--fcc-editable-region--
<input type="text" name="catphotourl" placeholder="cat photo URL">
--fcc-editable-region--
</form>
</section>
</main>
</body>
</html>