jQuery color selector

ii silver ii

ǝɹıɟpǝʞɔı&
Dec 18, 2008
767
23
0
I'm using the following for a simple jQuery color selector and have it working fine:
jQuery UI - Slider Demos & Documentation

But if I wanted to create four dynamic color pickers on one page so that a user could pick 4 colors, submit a form and all 4 colors were given as seperate inputs, how would I go about declaring and setting up these multiple pickers?

I could do it easily repeating the same code over and just changing div ids etc but there must be a simpler way, I guess using arrays?

The end plan is to have buttons.. Color1 Color2 Color3 Color4, which the user can click and load the right swatch to update and go onto the next, slightly like the twitter profile color selector.

Any tips would be great.
 


Got it working, see attachment.
 

Attachments

  • test.zip
    1.5 KB · Views: 1
I was going to say that you could use a server-side tagging language like php, jsp or asp. You could just iterate over the code or use some type of templating tool. You could have also returned JSON with an array of the results otherwise.