3.2 KiB
id | title | challengeType | dashedName |
---|---|---|---|
5efb2c990dc218d6c85f89b2 | Passo 42 | 0 | step-42 |
--description--
Mesmo que você tenha adicionado o botão abaixo do campo (input) de texto, eles aparecem um ao lado de outro na página. Isso ocorre porque os elementos input
e button
são elementos em linha (inline), que não aparecem em novas linhas.
Você aprendeu anteriormente que o botão envia o formulário por padrão, mas você pode adicionar explicitamente o atributo type
com o valor submit
para tornar isso mais claro. Faça isso e especifique para onde o botão deve enviar o formulário.
--hints--
O elemento button
deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: <elementName>
.
assert(document.querySelector('button'));
O elemento button
deve ter uma tag de fechamento. As tags de fechamento têm um caractere /
logo após o caractere <
.
assert(code.match(/<\/button\>/));
O elemento button
não tem um atributo type
. Verifique se há um espaço depois do nome da tag de abertura.
assert($('button')[0].hasAttribute('type'));
O novo elemento button
deve ter o atributo type
com o valor submit
. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas.
assert(
$('button')[0]
.getAttribute('type')
.match(/^submit$/i)
);
Embora você tenha definido o atributo type
do elemento button
com o valor submit
, é recomendável sempre cercar o valor de um atributo com aspas.
assert(!/\<\s*button\s+type\s*=\s*submit/i.test(code));
--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">
<input type="text" name="catphotourl" placeholder="cat photo URL" required>
--fcc-editable-region--
<button>Submit</button>
--fcc-editable-region--
</form>
</section>
</main>
</body>
</html>