Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placeholder value not showing in chrome?

Tags:

html

css

Here is my code. I don't understand why placeholder not shown in 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>
like image 907
Russel Monzur Avatar asked Dec 04 '14 05:12

Russel Monzur


People also ask

Why my placeholder is not working in HTML?

If you have an input in your form and placeholder is not showing because a white space at the beginning, this may be caused for you "value" attribute. In case you are using variables to fill the value of an input check that there are no white spaces between the commas and the variables.

How do I inspect a placeholder in Chrome?

Check the "Show user agent shadow DOM" checkbox and reload your page. You should now see the placeholder html output in your dev tools when you view the elements tab. Clicking on the placeholder html will bring up the applied styles for you to view or edit.

How do I add a placeholder to a date field?

The placeholder attribute does not work with the input type Date, so place any value as a placeholder in the input type Date. You can use the onfocus=”(this. type='date') inside the input filed.

Where is placeholder in HTML?

Definition and Usage The short hint is displayed in the input field before the user enters a value. Note: The placeholder attribute works with the following input types: text, search, url, tel, email, and password.


2 Answers

try OnFocus rather than using 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 whether it works or not

like image 71
Nad Avatar answered Nov 15 '22 22:11

Nad


Make sure you have the right colours set up, and one on focus, and the focus one comes later (for higher specificity). For instance:

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

input:focus::-webkit-input-placeholder {
    color: #888;
}
like image 34
Matthew Wilcoxson Avatar answered Nov 15 '22 23:11

Matthew Wilcoxson