--- id: bad87fee1348bd9aedf08835 title: Create a Set of Checkboxes challengeType: 0 videoUrl: '' localeTitle: 创建一组复选框 --- ## Description
表单通常使用checkboxes来表示可能有多个答案的问题。复选框是一种类型的input您的每一个复选框可以嵌套自身的内label元素。通过将input元素包装在label元素内部,它将自动将复选框输入与其周围的标签元素相关联。所有相关的复选框输入应具有相同的name属性。通过在label元素上设置for属性以匹配关联input元素的id属性,最佳做法是明确定义复选框input与其对应label之间的关系。这是一个复选框的示例: <label for="loving"><input id="loving" type="checkbox" name="personality"> Loving</label>
## Instructions
在表单中添加一组三个复选框。每个复选框应嵌套在自己的label元素中。这三者都应该分享personalityname属性。
## Tests
```yml tests: - text: 您的页面应该有三个复选框元素。 testString: 'assert($("input[type="checkbox"]").length > 2, "Your page should have three checkbox elements.");' - text: 三个复选框元素中的每一个都应嵌套在自己的label元素中。 testString: 'assert($("label > input[type="checkbox"]:only-child").length > 2, "Each of your three checkbox elements should be nested in its own label element.");' - text: 确保每个label元素都有一个结束标记。 testString: 'assert(code.match(/<\/label>/g) && code.match(/
## 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 ```