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