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

107 lines
4.2 KiB
Markdown

---
id: 5f1a89f1190aff21ae42105a
title: Step 60
challengeType: 0
dashedName: step-60
---
# --description--
Come per i pulsanti di opzione, i dati del modulo per le caselle di spunta selezionate sono coppie di attributi `name` / `value`. Anche se l'attributo `value` è opzionale, è buona pratica includerlo in qualsiasi casella di spunta o pulsante di opzione nella pagina.
Aggiungi un attributo `value` a ogni casella di spunta. Per comodità, imposta l'attributo `value` di ogni casella di spunta con lo stesso valore dell'attributo `id`.
# --hints--
Tutte e tre le caselle di spunta dovrebbero avere un attributo `value`. 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.
```js
const checkboxes = [...document.querySelectorAll('input[type="checkbox"]')];
assert(checkboxes.every((checkbox) => checkbox.hasAttribute('value')));
```
L'attributo `value` della casella di spunta `Loving` dovrebbe avere valore `loving`. Hai omesso il valore o hai un refuso. Ricorda che i valori degli attributi devono essere racchiusi tra virgolette.
```js
const lovingCheckbox = document.querySelector('#loving');
assert(lovingCheckbox.getAttribute('value').match(/^loving$/));
```
L'attributo `value` della casella di spunta `Lazy` dovrebbe avere valore `lazy`. Hai omesso il testo o hai un refuso. Ricorda che i valori degli attributi devono essere racchiusi tra virgolette.
```js
const lazyCheckbox = document.querySelector('#lazy');
assert(lazyCheckbox.getAttribute('value').match(/^lazy$/));
```
L'attributo `value` della casella di spunta `Energetic` dovrebbe avere valore `energetic`. Hai omesso il valore o hai un refuso. Ricorda che i valori degli attributi devono essere racchiusi tra virgolette.
```js
const energeticCheckbox = document.querySelector('#energetic');
assert(energeticCheckbox.getAttribute('value').match(/^energetic$/));
```
# --seed--
## --seed-contents--
```html
<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--
<fieldset>
<legend>Is your cat an indoor or outdoor cat?</legend>
<label><input id="indoor" type="radio" name="indoor-outdoor" value="indoor"> Indoor</label>
<label><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label>
</fieldset>
<fieldset>
<legend>What's your cat's personality?</legend>
<input id="loving" type="checkbox" name="personality"> <label for="loving">Loving</label>
<input id="lazy" type="checkbox" name="personality"> <label for="lazy">Lazy</label>
<input id="energetic" type="checkbox" name="personality"> <label for="energetic"> Energetic</label>
</fieldset>
--fcc-editable-region--
<input type="text" name="catphotourl" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</section>
</main>
</body>
</html>
```