--- id: bad87fee1348bd9aedd08835 title: Check Radio Buttons and Checkboxes by Default challengeType: 0 videoUrl: '' localeTitle: 默认情况下检查单选按钮和复选框 --- ## Description
您可以使用checked属性设置默认情况下要选中的复选框或单选按钮。为此,只需将“checked”一词添加到input元素的内部即可。例如: <input type="radio" name="test-name" checked>
## Instructions
默认情况下,设置第一个radio buttons和第一个checkboxes
## Tests
```yml tests: - text: 默认情况下,应检查表单上的第一个单选按钮。 testString: 'assert($("input[type="radio"]").prop("checked"), "Your first radio button on your form should be checked by default.");' - text: 默认情况下,应检查表单上的第一个复选框。 testString: 'assert($("input[type="checkbox"]").prop("checked"), "Your first checkbox on your form should be checked by default.");' ```
## Challenge Seed
```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats


```
## Solution
```js // solution required ```