I have some errors in my code Here is my error:
The for attribute of the label element must refer to a non-hidden form control.
And myd code:
<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>
What is wrong with it? Thanks!
The for attribute is an allowed attribute for <label> and <output> . When used on a <label> element it indicates the form element that this label describes. When used on an <output> element it allows for an explicit relationship between the elements that represent values which are used in the output.
Explanation: The for property is used to associate a label with a certain form control. The value of the for attribute must match the value of the form control's id attribute. The for property is used to associate a label with a certain form of control.
The <label> HTML element represents a caption for an item in a user interface.
The label for attribute must contain the input id value
<label for="foo">Foo:</label>
<input id="foo">
To omit the for and id attributes all-together, put input inside label
<label>
Foo: <input name="foo">
</label>
Also note, that input cannot be hidden <input type="hidden">
, however it can be styled as hidden <input style="display:none">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With