2.0 KiB
2.0 KiB
id | challengeType | videoUrl | forumTopicId | title |
---|---|---|---|---|
bad87fee1348bd9aedd08830 | 0 | https://scrimba.com/p/pVMPUv/cp2Nkhz | 16627 | 给表单添加提交按钮 |
Description
submit
提交按钮,当点击提交按钮时,表单中的数据将会被发送到action
属性指定的 URL 上。
例如:
<button type="submit">this button submits the form</button>
Instructions
button
按钮,按钮的type
属性值为submit
,文本为提交
。
Tests
tests:
- text: '表单内部应该有一个按钮。'
testString: assert($("form").children("button").length > 0);
- text: '按钮的<code>type</code>属性值应该为<code>submit</code>。'
testString: assert($("button").attr("type") === "submit");
- text: '提交按钮的文本应该为<code>提交</code>。'
testString: assert($("button").text().match(/^\s*submit\s*$/gi));
- text: '确保按钮有结束标记。'
testString: assert(code.match(/<\/button>/g) && code.match(/<button/g) && code.match(/<\/button>/g).length === code.match(/<button/g).length);
Challenge Seed
<h2>CatPhotoApp</h2>
<main>
<p>点击查看更多<a href="#">猫咪图片</a>。</p>
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="一只仰卧着的橘猫"></a>
<p>猫咪最喜欢的三件东西:</p>
<ul>
<li>猫薄荷</li>
<li>激光笔</li>
<li>千层面</li>
</ul>
<p>猫咪最讨厌的三件东西:</p>
<ol>
<li>祛跳蚤</li>
<li>打雷</li>
<li>同类</li>
</ol>
<form action="https://freecatphotoapp.com/submit-cat-photo">
<input type="text" placeholder="猫咪图片地址">
</form>
</main>