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

3.5 KiB

id title challengeType dashedName
5f05a1d8e233dff4a68508d8 Passo 46 0 step-46

--description--

Coloque outro botão de opção com a opção Outdoor em um novo elemento label. O novo botão de opção deve ser colocado depois do primeiro. Além disso, defina o valor do atributo id como:

outdoor

--hints--

Você precisará adicionar um novo elemento label no qual aninhará o novo botão de opção. Certifique-se de que os dois tenham uma tag de abertura e fechamento.

assert(
  document.querySelectorAll('label').length === 2 &&
    code.match(/<\/label\>/g).length === 2
);

O texto Outdoor deve estar localizado diretamente à direita do novo botão radio. Certifique-se de que haja um espaço entre o elemento e o texto. Você omitiu o texto ou tem um erro de digitação.

const radioButtons = [...$('input')];
assert(
  radioButtons.filter((btn) =>
    btn.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Outdoor/i)
  ).length
);

O novo botão de opção e o rótulo (label) associado a ele devem estar abaixo do primeiro botão. Elas estão na ordem errada.

const collection = [
  ...document.querySelectorAll('input[type="radio"]')
].map((node) => node.nextSibling.nodeValue.replace(/\s+/g, ''));
assert(collection.indexOf('Indoor') < collection.indexOf('Outdoor'));

O novo botão de opção deve ter um atributo id. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos.

assert($('input')[1].hasAttribute('id'));

O novo elemento de botão de opção deve ter o atributo id com o valor outdoor. 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($('input')[1].id.match(/^outdoor$/));

--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--
          <label><input id="indoor" type="radio"> Indoor</label>
--fcc-editable-region--
          <input type="text" name="catphotourl" placeholder="cat photo URL" required>
          <button type="submit">Submit</button>
        </form>
      </section>
    </main>
  </body>
</html>