How to Fix Form elements do not have associated labels in Wordpress Search Form (without button)
Is there any way to fix the Form elements do not have associated labels issue in WordPress search form without having the search button.
Google Light House Audit:
Form elements do not have associated labels. Labels ensure that form controls are announced properly by assistive technologies, like screen readers. Failing Elements input
input type=text value=Search name=s id=psf onblur=if (this.value == '') {this.value = 'Search';} onfocus=if (this.value == 'Search') {this.value = '';}
I want to add a label in the form w/o displaying the search button?
I'm using this code in my Wordpress website to display search form:
div id=psform
?php $search_text = Search; ?
form method=get id=searchform
action=?php bloginfo('home'); ?/
input type=text value=?php echo $search_text; ?
name=s id=psf
onblur=if (this.value == '')
{this.value = '?php echo $search_text; ?';}
onfocus=if (this.value == '?php echo $search_text; ?')
{this.value = '';} /
input type=hidden id=searchsubmit /
/form /div
Code can be found at https://tumrai.com/WordPress_Search_Form_without_Search_Button