The input field placeholder is not working.?

<form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url(home_url('/')); ?>">
  <input type="search" class="search rm-input" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder "Your name here"/>
  <input type="submit" style="display:none" id="searchsubmit" value="<?php echo esc_attr_x('Search', 'submit button'); ?>" />
</form>

I do not know why the placeholder text is not displayed in the field ...

enter image description here

+3
source share
6 answers

You missed '='Must be:

placeholder="Your name here"
+7
source

You forget the sign =(equal) in your input fields.

<input type="search" class="search rm-input" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="Your name here"/>
+2
source

= placeholder "Your name here"

, value . , .

 <input type="search" class="search rm-input" value="My name" name="s" id="s" placeholder="Your name here"/>

   <input type="search" class="search rm-input" value="" name="s" id="s" placeholder="Your name here"/>

: JsFiddle

PS: wordpress, searchform.php .

+1

, , bg.

:

input::-webkit-input-placeholder {
  color: #ffffff;
}

input:-moz-placeholder { 
  color: #ffffff;
}

input::-ms-input-placeholder  { 
  color: #ffffff;
}

I used the input as a selector, you should probably add some better specifics to this, perhaps give this input and identifier, for example, "searchBar", then use the selector input#searchBar

+1
source

It has been resolved now, this is a cache problem ...

+1
source

Placeholder does not work for inputs that are not a type of text, so you will need to use a value in your case, for example, value="What you want to be displayed"

0
source

All Articles