--- id: bad87fee1348bd9aede08830 title: Create a Form Element challengeType: 0 videoUrl: '' localeTitle: 创建表单元素 --- ## Description
您可以使用纯HTML来构建实际将数据提交到服务器的Web表单。您可以通过在form元素上指定操作来执行此操作。例如: <form action="/url-where-you-want-to-submit-form-data"></form>
## Instructions
将文本字段嵌套在form元素中,并将action="/submit-cat-photo"属性添加到表单元素中。
## Tests
```yml tests: - text: 将文本输入元素嵌套在form元素中。 testString: 'assert($("form") && $("form").children("input") && $("form").children("input").length > 0, "Nest your text input element within a form element.");' - text: 确保您的form具有设置为/submit-cat-photoaction属性 testString: 'assert($("form").attr("action") === "/submit-cat-photo", "Make sure your form has an action attribute which is set to /submit-cat-photo");' - text: 确保您的form元素具有格式良好的打开和关闭标记。 testString: 'assert(code.match(/<\/form>/g) && code.match(/
/g) && code.match(/<\/form>/g).length === code.match(//g).length, "Make sure your form element has well-formed open and close tags.");' ```
## 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 ```