3.3 KiB
id | title | challengeType | dashedName |
---|---|---|---|
5ef9b03c81a63668521804e1 | Step 49 | 0 | step-49 |
--description--
L'elemento fieldset
viene utilizzato per raggruppare insieme gli input e le etichette correlati in un modulo web. Gli elementi fieldset
sono block-level elements, il che significa che appaiono su una nuova riga.
Annida i pulsanti di opzione Indoor
e Outdoor
all'interno di un elemento fieldset
e non dimenticare di indentare i pulsanti di opzione.
--hints--
Entrambi i pulsanti di opzione dovrebbero essere ancora posizionati tra i tag di apertura e chiusura dell'elemento label
.
const labelChildNodes = [...$('label')].map((node) => [...node.childNodes]);
assert(
labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT')
.length === 2
);
L'elemento fieldset
dovrebbe avere un tag di apertura. I tag di apertura hanno la seguente sintassi: <nomeElemento>
.
assert(document.querySelector('fieldset'));
L'elemento fieldset
dovrebbe avere un tag di chiusura. I tag di chiusura hanno un carattere /
subito dopo il carattere <
.
assert(code.match(/<\/fieldset\>/));
Sia il pulsante di opzione che le etichette associate devono essere tra i tag di apertura e chiusura dell'elemento fieldset
.
const radioButtons = [...$('input[type="radio"]')];
assert(
radioButtons.every((btn) => btn.parentNode.parentNode.nodeName === 'FIELDSET')
);
--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" name="indoor-outdoor" value="indoor"> Indoor</label>
<label><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> 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>