我的代码中有一些错误
这是我的错误:
和myd代码:
<form action="/search">
<span class="input input--hoshi search-wrapp main-page-open" style="display:block">
<input class="input__field input__field--hoshi" type="text" id="search" name="keyword" placeholder="Search..."/>
<label class="input__label input__label--hoshi input__label--hoshi-color-2" for="input-5">
<!--<span class="input__label-content input__label-content-hoshi">Search...</span>-->
</label>
<span class="icon-serch"></span>
</span>
<input id="search-btn" type="submit" style="display: none;"/>
</form>
怎么了谢谢!
最佳答案
属性的标签必须包含输入ID 值
<label for="foo">Foo:</label>
<input id="foo">
要完全省略和 ID的属性的,请将输入放在标签中
<label>
Foo: <input name="foo">
</label>
还要注意,输入不能是隐藏的
<input type="hidden">
,但是可以将其设置为隐藏的<input style="display:none">
关于html - label元素的for属性必须引用非隐藏表单控件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38569235/