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

3.2 KiB

id title challengeType dashedName
5ef9b03c81a63668521804d9 Step 40 0 step-40

--description--

Il testo segnaposto viene utilizzato per dare agli utenti un suggerimento sul tipo di informazioni da inserire in un input. Ad esempio, <input type="text" placeholder="Email address">.

Aggiungi il testo segnaposto cat photo URL al tuo elemento input.

--hints--

Hai eliminato il tuo elemento input oppure ha una sintassi non valida. Tutti i valori degli attributi dovrebbero essere circondati da virgolette.

assert($('input').length);

L'elemento form dovrebbe contenere solo l'elemento input. Rimuovi qualsiasi elemento HTML o testo aggiuntivo all'interno dell'elemento form.

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

L'elemento input non ha un attributo placeholder. Verifica che ci sia uno spazio dopo il nome del tag di apertura e/o che ci siano spazi prima di tutti i nomi degli attributi.

assert($('input')[0].hasAttribute('placeholder'));

L'elemento input deve avere un attributo placeholder con il valore cat photo URL. Hai omesso il valore o hai un refuso. Ricorda che i valori degli attributi devono essere racchiusi tra virgolette.

assert(
  $('input')[0]
    .getAttribute('placeholder')
    .replace(/\s+/g, ' ')
    .match(/^cat photo URL$/i)
);

Sebbene tu abbia impostato l'attributo placeholder dell'elemento input su cat photo URL, è raccomandato inserire sempre il valore di un attributo tra virgolette.

assert(!/\<\s*input\s+placeholder\s*=\s*cat\s+photo\s+url/i.test(code));

--seed--

--seed-contents--

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