![](/img/trans.png)
[英]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
[英]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
我在一個班級,我的任務是向頁面添加表單並使用 w3c html 驗證器驗證頁面。 我收到錯誤:
錯誤:標簽元素的 for 屬性值必須是非隱藏表單控件的 ID。
該錯誤僅適用於表單中 textarea 元素的標簽,而不適用於任何輸入元素。 這是表單的 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>
在此先感謝您的幫助。
檢查 <textarea> 中的引號(特別是“id”和“name”屬性)...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.