-1

I want set color for placeholder in input.I write this code for my input

 $('#txtEmailForgot').attr('placeholder', function () {
    $(this).css('color', '#6C6C6C');
 });`

It works good and when I type the text in input, it must be black but it has the same color like words in placeholder. How I can set color special for text when I want type something in this input. Thanks a lot!

Josh Powell
  • 6,219
  • 5
  • 31
  • 59

1 Answers1

0

Try with pure css,

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

:-moz-placeholder { /* Firefox 18- */
   color: red;  
}

::-moz-placeholder {  /* Firefox 19+ */
   color: red;  
}

:-ms-input-placeholder {  
   color: red;  
}

This will style all input and textarea placeholders.

Fiddle Demo

http://css-tricks.com/snippets/css/style-placeholder-text/

Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188