The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

On click, this sends a value to a text field named rgb. The value is that of a color, like #FF0000

What I want, along with sending the color name, it also changes the background color of the text field. Like if it sends the value #FF0000 to my text field, the background color of the text field becomes #FF0000 (other thigns remain same, like it will still send the value #FF0000 as text to the text field).

It should be backgroundColor, not background. It would be a good idea to integrate that into the showColorPicker function instead of putting it inline in the HTML. In fact, you could probably make the whole thing function just by doing onclick="showColorPicker(this)".

About the showColorPicker funnction, well, I'm using an opensource color picker here from dhtmlgoodies and that's a 600 line long code ... beyond my js knowledge to mess with that ...

problem with the code is that once user has chosen a color, he see only the color code, and not very user friendly as few people can know by heart which color code stands for which color. I was thinking to change this so that people can see which color they have choosen, when they chooses a color.

A better solution could be to do something onchange, as there are people who can change the code manually.

wow, thanks a lot. It's working by removing the quotes. However, still a little thing.

It is changing the color on second click, and not the first click. Means, on the first click I get a color picker, I choose a color, the color picker gets closed. Next, when I click there a second time, I get the color that I selected before. Hmmm ... probably i need a different even handler here ...