freeCodeCamp/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-ca.../5ef9b03c81a63668521804d8.md

3.1 KiB

id title challengeType dashedName
5ef9b03c81a63668521804d8 Passo 36 0 step-36

--description--

O elemento input permite a você várias maneiras de coletar dados a partir de um formulário da web. Assim como os elementos img, os elementos input são de fechamento automático e não precisam de tags de fechamento.

Adicione um elemento input dentro do elemento form.

--hints--

O elemento form deve ter uma tag de abertura e uma de fechamento na ordem correta. Pode ser que você não tenha inserido uma delas, as duas, ou que elas estejam na ordem errada.

const noSpaces = code.replace(/\s/g, '');
assert(
  document.querySelector('form') &&
    code.match(/<\/form>/g) &&
    noSpaces.indexOf('<form') < noSpaces.indexOf('</form>')
);

A tag de abertura do elemento form deve ter apenas o atributo action. Remova qualquer outra coisa que você possa ter digitado nela.

assert([...document.querySelector('form').attributes].length < 2);

Você deve criar um elemento input. Confira a sintaxe.

assert(document.querySelector('input'));

O elemento input deve ter uma tag de abertura, mas não uma de fechamento.

assert(document.querySelector('input') && !code.match(/<\/input\>/g));

O elemento input deve estar dentro do elemento form.

assert(document.querySelector('form > input'));

O elemento form deve conter apenas o elemento input. Remova os elementos HTML ou o texto entre as tags do elemento form.

assert(
  $('form')[0].children.length === 1 &&
    $('form')[0].innerText.trim().length === 0
);

--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>
--fcc-editable-region--
        <form action="https://freecatphotoapp.com/submit-cat-photo">
        </form>
--fcc-editable-region--
      </section>
    </main>
  </body>
</html>