【问题标题】:Form control attribute label error message from WC3来自 WC3 的表单控件属性标签错误消息
【发布时间】:2015-01-08 18:08:12
【问题描述】:

我遇到了一个令我完全困惑的 WC3 错误。

标签元素的for属性必须引用表单控件。 …你是人:在盒子里写代码 »

<label for="txtCaptcha"> Write code in box &raquo; <span id="txtCaptchaDiv" style="color:#29372F; font-weight:bold;"></span><!-- this is where the script will place the generated code --> 
<input type="hidden" id="txtCaptcha" name="txtCaptcha"/></label><!-- this is where the script will place a copy of the code for validation: this is a hidden field -->
<input type="text" name="txtInput" id="txtInput" size="30" />

我有 for="txtCaptcha" 指的是隐藏的输入控件 ID,所以我不确定 WC3 在说什么。任何帮助将不胜感激。

要求提供更多信息。我试图将整个表单放在这里,但由于某种原因,代码块不接受所有代码。它将它分解,然后当我尝试提交时,它不会让我因为代码不在代码块中。

页面在这里http://skeeterz71.com/gothic/quote-page.html line 641 第 641 行,第 55 列:标签元素的 for 属性必须引用表单控件。 …你是人:在盒子里写代码 »

谢谢

【问题讨论】:

  • 为什么隐藏的输入应该有标签?有意义吗?

标签: javascript forms


【解决方案1】:

你提到的错误如下:

问题是隐藏字段是不可标记的,你可以直接从规范中读取:

4.10.2 Categories

某些元素(并非全部与表单相关)被归类为 可标记元素。这些是可以与 标签元素。

按钮输入(如果type属性不处于隐藏状态)keygen 仪表输出进度选择文本区域

HTML/Elements/input/hidden

<input type="hidden">

隐藏状态表示一个不打算成为的值 由用户检查或操纵。

【讨论】:

    猜你喜欢
    • 2015-02-21
    • 2020-11-04
    • 1970-01-01
    • 2021-12-12
    • 1970-01-01
    • 1970-01-01
    • 2018-04-10
    • 1970-01-01
    • 2015-08-19
    相关资源
    最近更新 更多