--- id: bad87fee1348bd9aede08830 challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cmQ3Kfa' forumTopicId: 16817 title: 创建一个表单 --- ## Description
如果想使用 HTML 向服务器提交数据,可以给form添加action属性。 例如: <form action="/url-where-you-want-to-submit-form-data"></form>
## Instructions
input输入框外层创建一个form表单,然后设置表单的action属性为"https://freecatphotoapp.com/submit-cat-photo"
## Tests
```yml tests: - text: '在input输入框外层创建一个form表单。' testString: assert($("form") && $("form").children("input") && $("form").children("input").length > 0); - text: '确保表单的action属性为"https://freecatphotoapp.com/submit-cat-photo"。' testString: assert($("form").attr("action") === "https://freecatphotoapp.com/submit-cat-photo"); - text: '确保表单有开始标记和结束标记。' testString: assert(code.match(/<\/form>/g) && code.match(/
/g) && code.match(/<\/form>/g).length === code.match(//g).length); ```
## Challenge Seed
```html

CatPhotoApp

点击查看更多猫咪图片

一只仰卧着的萌猫

猫咪最喜欢的三件东西:

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

猫咪最讨厌的三件东西:

  1. 跳蚤
  2. 打雷
  3. 同类
```
## Solution