0

I'm trying to update placeholder text from within an AJAX function where I'm getting a hex value for the font color of my new div. However changing placeholder text with the pseudo elements

$(".dynamicColor textarea::-webkit-input-placeholder").css('color', data.FontColor);

does not work.

Here's my HTML and a Fiddle :

<div class="dynamicColor">

    <textarea name="text" placeholder="scientifik"></textarea>    

</div>

I've already commented on this SO question. That question is in regards to basic placeholder pseudo manipulation.

Community
  • 1
  • 1
Ben Racicot
  • 5,332
  • 12
  • 66
  • 130
  • `.delay()` does not apply to `css` ***styles*** – Roko C. Buljan Feb 10 '15 at 21:38
  • you can't do that. you'll have to swap classes around instead, which unfortunately won't work for you because you're color is dynamic, leaving the only option being creating and appending an inline style tag. – Kevin B Feb 10 '15 at 21:41
  • .delay is so you can see it work / not work after 3 seconds but you knew that ;) – Ben Racicot Feb 10 '15 at 21:43
  • @BenRacicot Right, but it won't do that. .delay() only delays animations, and things in the .queue() – Kevin B Feb 10 '15 at 21:44
  • Hmm I've updated the fiddle with an inline style but can't get the pseudo elem to work. Has anyone got this to work inline? – Ben Racicot Feb 10 '15 at 21:47
  • `window.setTimeout(function(){ $("head").append(""); }, 3000);` – alessandrio Feb 10 '15 at 22:05
  • [delay](http://api.jquery.com/delay/) only works for items in the queue (such as animations). For anything else, use a [regular old timer](https://developer.mozilla.org/en-US/docs/DOM/window.setTimeout) – alessandrio Feb 10 '15 at 22:06
  • Thanks Avril! I came to almost the same conclusion but you must be able to REPLACE the color styles too. Notice how I did it if you can. Thanks all. – Ben Racicot Feb 10 '15 at 22:27

0 Answers0