Change input's placeholder's style-attributes for iOS through jQuery

alkutob

New Member
For other browsers, simply setting \[code\]#input-element { color: red; }\[/code\] is sufficient to also color an input's placeholder text (\[code\]<input type="text" placeholder="foo" />\[/code\]).However, this is not the case on iOS; which requires the following instead (perhaps more appropriate, but still):\[code\]#input-element::-webkit-input-placeholder { color: red; }\[/code\]Fine, that's no problem. However, I'm trying to do this with jQuery, without much success. I've tried the following:\[code\]$("#input-element::-webkit-input-placeholder").css('color', 'red');$("#input-element").css('::-webkit-input-placeholder', 'color: red'); // not according to .css documentation: I'm aware\[/code\]However, none of these did any change. I'm trying to avoid appending (\[code\]$(head).append("<style>..");\[/code\] the style directly to the document.How to change an input's placeholder style-attributes trough jQuery
 
Back
Top