本文介绍了灯塔错误:“表单元素没有关联的标签"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我该如何解决Lighthouse错误:
How do I fix this Lighthouse error:
<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
属性.我认为标签是最简单的,但我将向您展示其中一个.
For each of these you can add a label that references the element, or use the aria-labelledBy
attribute. I think labels are easiest but I will show you one of each.
<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>
这篇关于灯塔错误:“表单元素没有关联的标签"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!