Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第 67 期(W3C 标准-HTML):form 特性 #70

Open
wingmeng opened this issue Jul 23, 2019 · 0 comments
Open

第 67 期(W3C 标准-HTML):form 特性 #70

wingmeng opened this issue Jul 23, 2019 · 0 comments

Comments

@wingmeng
Copy link
Collaborator

HTML5 中的表单,无论是在表现方面,还是在功能方面,都非常优越,使用 HTML5 表单的某些特性,可以轻松的开发出以往需要写大量代码的表单页面效果。

今天要介绍的是表单的 form 特性,利用它可以把从属于表单的元素放在任何地方,只需指明该元素的 form 特性值为表单 id 即可,这样该元素就从属于表单了。

<!-- 这里用 form="form1" 指明对应的表单 -->
<input type="text" name="username" form="form1" required>

<form id="form1">
  <input type="submit" value="提交">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant