--- id: bad87fee1348bd9aedd08835 title: Check Radio Buttons and Checkboxes by Default challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cWk3Qh6' forumTopicId: 301094 localeTitle: 给单选按钮和复选框添加默认选中项 --- ## Description
如果想设置某个单选按钮或多选按钮默认被选中,只需给input元素添加 "checked" 属性。 例如: <input type="radio" name="test-name" checked>
## Instructions
把第一个radio button和第一个checkbox都设置为默认选中。
## Tests
```yml tests: - text: '表单的第一个单选按钮应该被默认选中。' testString: assert($('input[type="radio"]').prop("checked")); - text: '表单的第一个多选按钮应该被默认选中。' testString: assert($('input[type="checkbox"]').prop("checked")); ```
## Challenge Seed
```html

CatPhotoApp

点击查看更多猫咪图片

一只仰卧着的萌猫

猫咪最喜欢的三件东西:

  • 猫薄荷
  • 激光笔
  • 千层饼

猫咪最讨厌的三件东西:

  1. 跳蚤
  2. 打雷
  3. 同类


```
## Solution