关于带有标签字段的表单,this (out-dated) jQuery Mobile documentation状态:
Be sure to pair them properly with label elements via the for attribute.
for 属性在最新版本中仍然存在,但是the current documentation甚至不再提及它。它是干什么用的?某种形式的验证?
最佳答案
它是用于将文本与相应输入元素链接起来的标准 HTML(非 jQm 特定的)。
例子:
<label for="your_name">Your Name:</label>
<input id="your_name" value="John Smith" />
当我点击标签时,输入文本将获得焦点。 for
属性应设置为输入元素的 ID。
关于javascript - jQuery 表单标签上的 for 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23427691/