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

form 表单中使用 label 标签 for 属性绑定表单其他元素的问题 #179

Closed
ayu-test opened this issue Jul 11, 2019 · 0 comments
Closed

Comments

@ayu-test
Copy link

ayu-test commented Jul 11, 2019

书中及源码中涉及到 label 标签 for 属性用法大多如下所示:

<form>
  <label for="username">Username</label><br>
  <input type="text" name="username" placeholder="Bob"><br>
  ...
</form>

而 label 标签 for 属性在绑定到表单中其他元素的时,应该使 for 属性的值 = 被绑定元素 id 属性的值,也即上述标记片段应该表述为如下所示的片段:

<form>
  <label for="username">Username</label><br />
  <input type="text" id="username" name="username" placeholder="Bob"><br />
  ...
</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