Placeholder value not showing in chrome?

Here is my code. I don't understand why the placeholder is not shown in the explorer. Please, help.

Html code

<form  method="post" >
  <input type="text" class="field" name="nom" placeholder="Votre Nom">
  <input type="text" class="field" name="telephone" placeholder="TΓ©lΓ©phone">
  <center><input type="submit" id="submit_btn" value="Valider" class="btn_submit"></center>
</form>

      

+3


source to share


2 answers


try OnFocus rather than use placeholder it will work

<input name="nom" type="text" value="Votre Nom" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">

      



Let me know if it works or not.

+9


source


Make sure you have the correct colors set up with one on focus and focus later (for more specificity). For example:



input::-webkit-input-placeholder {
    color: transparent;
}

input:focus::-webkit-input-placeholder {
    color: #888;
}

      

+1


source







All Articles