Monday, January 11, 2010

It's been a while since I build this small plugin for jQuery, While browsing through my files I try to see if this plugin still works with the latest version of jQuery which is 1.3.2 and it did. I have updated the sample and change the file names so it is easy to recognize. I also move the downloads to my google site, Download here.

Focus on the input box below or click on the box next to the control to show color picker.

Yes, setting default value is easy: Setting value in the input tag or through js in document.ready.However, once the color picker is attached, I am not able to change it.When I am trying to change the value through an event using the setValue function, the color doesn't change and I am getting 'undefined' in the input box.

Hi again, I found a solution to my problem.I have been trying different things with setValue and I couldn't make it work.

To change the color of the colorpicker we can use var color = '#CC0000'; $('.ColorPickerDivSample').css({'background-color' : color});

The class .ColorPickerDivSample is the class for a span where the box with the colorpicker is created, right?

So, if we want to allow to input manually the color typing it in the input, we could do something like this:$('input').change( function () { var newColor = $(this).val(); $('.ColorPickerDivSample').css({'background-color' : newColor}); });

I am doing all these cos I would like to change the colors through events and cos I have an unknown number colorpickers. so the same example for an unknown number of colorpickers could be as follow (although, probably there is a simpler solution):

This is just what I was looking for, but I have run into a problem. It works fine where I don't use other JQUery scripts, but I have script libraray that contains a document ready handler which seems to prevent the handle in your script from creating your object instance. Any suggestions?