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

99 lines
3.3 KiB
Markdown
Raw Normal View History

---
id: 5ef9b03c81a63668521804de
title: Step 47
challengeType: 0
dashedName: step-47
---
# --description--
Nota che entrambi i pulsanti di opzione possono essere selezionati contemporaneamente. Per fare in modo che la selezione di un pulsante di opzione deselezioni automaticamente l'altro, entrambi i pulsanti devono avere un attributo `name` con lo stesso valore.
Aggiungi l'attributo `name` con il valore `indoor-outdoor` a entrambi i pulsanti di opzione.
# --hints--
Entrambi i pulsanti di opzione dovrebbero essere ancora posizionati tra i tag di apertura e chiusura dell'elemento `label`.
```js
const labelChildNodes = [...document.querySelectorAll('form > label')].map(
(node) => node.childNodes
);
assert(
labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT')
.length === 2
);
```
Entrambi i pulsanti di opzione dovrebbero avere un attributo `name`. 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 radioButtons = [...document.querySelectorAll('input[type="radio"]')];
assert(radioButtons.every((btn) => btn.hasAttribute('name')));
```
Entrambi i pulsanti di opzione dovrebbero avere un attributo `name` con il valore `indoor-outdoor`. Hai omesso il valore o hai un refuso. Ricorda che i valori degli attributi devono essere racchiusi tra virgolette.
```js
const radioButtons = [...$('input[type="radio"]')];
assert(
radioButtons.every((btn) =>
btn.getAttribute('name').match(/^indoor-outdoor$/)
)
);
```
# --seed--
## --seed-contents--
```html
<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>
<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>
<label><input id="outdoor" type="radio"> Outdoor</label>
--fcc-editable-region--
<input type="text" name="catphotourl" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</section>
</main>
</body>
</html>
```