jQuery jPicker > Assign color of jPicker from a text link (not from jPicker)

Posted by Scott B on Stack Overflow See other posts from Stack Overflow or by Scott B
Published on 2010-03-22T00:41:04Z Indexed on 2010/03/22 1:01 UTC
Read the original article Hit count: 574

Filed under:

I've got a list of frequently used hex colors that I'd like to list under my jPicker bound input text field and I'd like to figure out how to change the value of the jPicker active color without opening the jPicker color selector palette.

I've managed to create a function that updates the input field thats bound to the jPicker, but the colors of the background and picker.gif do not update. I'd like to force the background colors to update as if the color was selected from jPicker itself.

Here's my code for the activation link...

<span onclick=doColor(1,'cc9900')>cc9900</span>

And here's the js handler

function doColor(el, color)
 {
 if(el){$('#theme_header_color').attr('value', color);}
 else{$('#theme_sidebar_color').attr('value', color);}
 }

© Stack Overflow or respective owner

Related posts about jQuery