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
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
我在 class 的任务是向页面添加表单并使用 w3c html 验证器验证页面。我收到错误:
Error: The value of the for attribute of the label element must be the
ID of a non-hidden form control.
该错误仅适用于表单中 textarea 元素的标签和输入元素的 none。这是表单的 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>
在此先感谢您的帮助。
检查
我在 class 的任务是向页面添加表单并使用 w3c html 验证器验证页面。我收到错误:
Error: The value of the for attribute of the label element must be the ID of a non-hidden form control.
该错误仅适用于表单中 textarea 元素的标签和输入元素的 none。这是表单的 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>
在此先感谢您的帮助。
检查