[英]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.