PDA

View Full Version : how to change text color in text area-javascript



druveen
09 Sep 2009, 08:01 AM
I am having a color picker which gives a color code , i have to change the color of text/font in textarea according to color code generated dynamically.... i am unable to use color code to change the text color plz help

dmcleary
10 Sep 2009, 07:09 AM
Hello druveen,

You might need to post some of your code to make sense.

But, something like this should work:

<input type="hidden" id="chosenColour" value="#ABCDEF" />

<div onclick="document.getElementById('changeMe').style.color=document.getElementById('chosenColour').value;">Change the colour</div>

<div id="changeMe">I will change colour!</div>

Of course you need to integrate that with your colour picker but hopefully you get the idea.

(Sorry for the *correct* spelling of colour for all you US folks :) )

Regards,


David