--- id: bad87fee1348bd9aedd08835 title: Spuntare pulsanti di opzione e caselle di spunta di default challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cWk3Qh6' forumTopicId: 301094 dashedName: check-radio-buttons-and-checkboxes-by-default --- # --description-- Puoi settare una casella di spunta o un pulsante di opzione in modo che sia spuntato di default usando l'attributo`checked`. Per fare questo puoi semplicemente aggiungere la parola `checked`all'interno di un elemento `input`. Per esempio: ```html ``` # --instructions-- Setta il primo dei tuoi pulsanti di opzione e la prima delle tue caselle di spunta in modo che siano entrambi settati di default. # --hints-- Il primo pulsante di opzione del tuo modulo dovrebbe essere selezionato di default. ```js assert($('input[type="radio"]').prop('checked')); ``` La prima casella di spunta del tuo modulo dovrebbe essere spuntata di default. ```js assert($('input[type="checkbox"]').prop('checked')); ``` Non dovresti cambiare il testo all'interno dell'etichetta `Indoor`. ```js assert.equal(document.querySelector('label[for="indoor"]')?.innerText?.trim(), 'Indoor'); ``` Non dovresti cambiare il testo all'interno dell'etichetta `Loving`. ```js assert.equal(document.querySelector('label[for="loving"]')?.innerText?.trim(), 'Loving'); ``` # --seed-- ## --seed-contents-- ```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats


``` # --solutions-- ```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats


```