Sadia
Sadia

Reputation: 181

Input Field Placeholder 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 don't know why the placeholder text is not displaying in the field ...

enter image description here

Upvotes: 5

Views: 21237

Answers (6)

Sadia
Sadia

Reputation: 181

It's Resolved now it was a cache issue ...

Upvotes: 1

Aady Ahmed
Aady Ahmed

Reputation: 33

Placeholder doesn't work for Inputs that are not the types text so you will have to use value in your case like this value="What you want to be displayed"

Upvotes: 2

asimovwasright
asimovwasright

Reputation: 838

It could be that the placeholder color is not inherited from the parent, so it might be black, and invisible on black bg.

You can change it like this:

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

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

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

I used input as the selector, you should probably add some better specificity to that, maybe give that input and ID like "searchBar" then use the selector input#searchBar

Upvotes: 1

zakhefron
zakhefron

Reputation: 1443

Missing = in placeholder "Your name here"

Placeholder text will be shown only if the value attribute is empty.In your example it has value, so value will be shown there.

With value

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

Without value

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

Refer : JsFiddle

PS: If you are using wordpress create searchform.php in your theme folder and add the form there .

Upvotes: 2

user5876330
user5876330

Reputation: 79

You forget = (equal) sign 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"/>

Upvotes: 2

MuthaFury
MuthaFury

Reputation: 815

You missed out '=' Should be:

placeholder="Your name here"

Upvotes: 9

Related Questions