Visitar URL original
第 67 期(W3C 标准-HTML):form 特性 · Issue #70 · fezaoduke/fe-practice-hard · GitHub
Skip to content

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

Description

@wingmeng

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

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

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

<form id="form1">
  <input type="submit" value="提交">
</form>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions