-
15 Jan 2013 9:29 AM #1
Unanswered: How can I change the color of a textfield placeholder
Unanswered: How can I change the color of a textfield placeholder
Hi,
How can I set the color of a placeholder for a specific text input?
Thanks in advance,
Eric
-
15 Jan 2013 9:41 AM #2
Fire up your app in Chrome (or Safari if you like pain), right click over the top of your placeholder and choose "inspect element". The inspector will show all of the styles and classes applied to that particular element. Find the class hierarchy then override it in your own css. You might have to add "!important" at the end of your overrides to get it to work. Use this same technique anytime you're not offered a more convenient way to override such as a SASS mixin or config property.
Hope that helps
John
-
17 Jan 2013 4:57 AM #3
Hi guys,
After some googling I've found out how to do it. I'm using the following sass snippet to declare a placeholder-errror class and then I add it to the correspondent input text. Note that the class has to be added to the input text element so I couldn't use properties like cls of textfield component. I had to "manually" selecting the DOM element with aid of document.querySelector to pick the proper input text and then adding the class.
It's also important to note that this feature won't work in all browsers.
Cheers,Code:$error-color: red; .placeholder-error { color: $error-color; &::-webkit-input-placeholder { color: $error-color; } &:-moz-placeholder { color: $error-color; } &:-ms-input-placeholder { color: $error-color; } }
Eric.


Reply With Quote