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

2.9 KiB

id title challengeType dashedName
5ef9b03c81a63668521804da Step 41 0 step-41

--description--

Utilizza l'elemento button per creare un pulsante su cui poter cliccare. Ad esempio, <button>Click Here</button> crea un pulsante con il testo Click Here.

Aggiungi un elemento button con il testo Submit sotto l'elemento input. In seguito a un click su un pulsante modulo senza alcun attributo, il modulo viene inviato di default alla posizione specificata nell'attributo action del modulo.

--hints--

L'elemento button dovrebbe avere un tag di apertura. I tag di apertura hanno questa sintassi: <nomeElemento>.

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

L'elemento button dovrebbe avere un tag di chiusura. I tag di chiusura hanno un carattere / subito dopo il carattere <.

assert(code.match(/<\/button\>/));

Il testo dell'elemento button dovrebbe essere Submit. Hai omesso il testo o hai un refuso.

assert(document.querySelector('button').innerText.toLowerCase() === 'submit');

L'elemento button dovrebbe essere sotto l'elemento input. Sono nell'ordine sbagliato.

const collection = [...document.querySelectorAll('input, button')].map(
  (node) => node.nodeName
);
assert(collection.indexOf('INPUT') < collection.indexOf('BUTTON'));

--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" required>
--fcc-editable-region--
        </form>
      </section>
    </main>
  </body>
</html>