如何修复此灯塔错误:
Form elements do not have associated labels
<input type="text" id="s" name="s" value="Arama..." onfocus="if (this.value == 'Arama...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Arama...';}">
<select id="main-menu-mob">
<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>
最佳答案
对于其中的每一个,您可以添加一个引用该元素的标签,或使用 aria-labelledBy
属性。我认为标签是最简单的,但我将向您展示每个标签。
<label for="s">Arama...</label>
<input type="text" id="s" name="s" value="Arama..." onfocus="if (this.value == 'Arama...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Arama...';}">
<label id="lbl-main-menu-mob">Select Item</label>
<select id="main-menu-mob" aria-labelledby="lbl-main-menu-mob">
<label for="comment">Enter Comment</label>
<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>
关于html - 灯塔错误 : "Form elements do not have associated labels",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56083674/