--- id: bad87fee1348bd9aedf08830 challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cKdJDhg' forumTopicId: 16647 title: 给输入框添加占位符文本 --- ## Description
Placeholder占位符是用户在input输入框中输入任何东西前的预定义文本。 你可以像这样创建一个占位符: <input type="text" placeholder="this is placeholder text">
## Instructions
input输入框的placeholder占位符文本设置为 “猫咪图片地址”。
## Tests
```yml tests: - text: 给现有的input输入框添加一个placeholder属性。 testString: assert($("input[placeholder]").length > 0); - text: 设置placeholder属性的值为 ”猫咪图片地址“。 testString: assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/猫咪图片地址/gi)); - text: 完整的input元素应有一个结束标签 testString: assert(!code.match(/.*<\/input>/gi)); - text: input输入框的语法必须正确。 testString: assert($("input[type=text]").length > 0); ```
## Challenge Seed
```html

CatPhotoApp

点击查看更多猫咪图片

一只仰卧着的萌猫

猫咪最喜欢的三件东西:

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

猫咪最讨厌的三件东西:

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