简体   繁体   English

表单中的Textarea标签:错误:标签元素的for属性值必须是非隐藏表单控件的ID

[英]Textarea Label in Form: Error: The value of the for attribute of the label element must be the ID of a non-hidden form control

I'm in a class where I'm tasked with adding a form to a page and validate the page using w3c html validator.我在一个班级,我的任务是向页面添加表单并使用 w3c html 验证器验证页面。 I get the error:我收到错误:

Error: The value of the for attribute of the label element must be the ID of a non-hidden form control.错误:标签元素的 for 属性值必须是非隐藏表单控件的 ID。

The error only applies to the label for the textarea element in the form and none of the input elements.该错误仅适用于表单中 textarea 元素的标签,而不适用于任何输入元素。 Here's the HTML for the form:这是表单的 HTML:

<form id="contactForm" class="form-grid"> <!-- Start Form -->
            <fieldset>
                
                <legend>Contact Information</legend>
                
                <label for="contactFirstName">First Name:</label>
                <input type="text" name="contactFirstName" id="contactFirstName">
                
                <label for="contactLastName">Last Name:</label>  
                <input type="text" name="contactLastName" id="contactLastName"> 
                
                <label for="contactEmail">Email:</label>
                <input type="email" name="contactEmail" id="contactEmail">
                
                <label for="contactPhone">Phone:</label>
                <input type="tel" name="contactPhone" id="contactPhone">
                
                <label for="contactMessage">Message:</label>
                <textarea id=“contactMessage” name=“contactMessage” rows="5" cols="35"></textarea>
                
            </fieldset>
            
            <input type="submit"  id="submit"  value="SUBMIT"  class="btn">
        </form>

Thanks in advance for the help.在此先感谢您的帮助。

检查 <textarea> 中的引号(特别是“id”和“name”属性)...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么会出现这个错误label元素的for属性值必须是非隐藏表单控件的ID - Why am I getting this error The value of the for attribute of the label element must be the ID of a non-hidden form control 标签元素的for属性的值必须是非隐藏表单控件的ID吗? - The value of the for attribute of the label element must be the ID of a non-hidden form control? label元素的for属性必须引用非隐藏表单控件 - The for attribute of the label element must refer to a non-hidden form control label元素的for属性必须引用非隐藏表单控件<label for=“Country” >Countr</label> - The for attribute of the label element must refer to a non-hidden form control <label for=“Country” >Countr label元素的for属性必须引用表单控件吗? - The for attribute of the label element must refer to a form control? label元素的for属性是否必须引用表单控件错误? - The for attribute of the label element must refer to a form control error? 验证HTML时出错:label元素的for属性必须引用表单控件 - Error validating HTML: The for attribute of the label element must refer to a form control 验证HTML:label元素的for属性必须引用表单控件 - validating HTML: The for attribute of the label element must refer to a form control 选择表单中的第一个非隐藏输入 - Selecting the first non-hidden input in a form 元素表单上属性操作的错误值:必须非空 - Bad value for attribute action on element form: Must be non-empty
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM