Click here to view more cat photos.

Things cats love:
- cat nip
- laser pointers
- lasagna
Top 3 things cats hate:
- flea treatment
- thunder
- other cats
--- id: bad87fee1348bd9aedd08835 title: 給單選按鈕和複選框添加默認選中項 challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cWk3Qh6' forumTopicId: 301094 dashedName: check-radio-buttons-and-checkboxes-by-default --- # --description-- 用 `checked` 屬性把第一個複選框和單選按鈕都設置爲默認選中。 爲此,只需將單詞 `checked` 添加到 `input` 元素的內部。 例如: ```html ``` # --instructions-- 把第一個單選按鈕和第一個複選框都設置爲默認選中。 # --hints-- 表單的第一個單選按鈕應被默認選中。 ```js assert($('input[type="radio"]').prop('checked')); ``` 表單的第一個複選框應被默認選中。 ```js assert($('input[type="checkbox"]').prop('checked')); ``` 不應該更改 `Indoor` 標籤的內部文本。 ```js assert.equal(document.querySelector('label[for="indoor"]')?.innerText?.trim(), 'Indoor'); ``` 不應該更改 `Loving` 標籤的內部文本。 ```js assert.equal(document.querySelector('label[for="loving"]')?.innerText?.trim(), 'Loving'); ``` # --seed-- ## --seed-contents-- ```html
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate:
Click here to view more cat photos.
Things cats love:
Top 3 things cats hate: