Search code examples
jquerycolor-picker

jquery colpick color plugin, programmatically set color


How to set color to elements that is initialized with jQuery's colpick plugin. like

$('#bg-color').colpick();

Is there any method to set colour so that the element's color is changed with value of the hidden color input field. I am expecting a function may be like

$('#bg-color').setColor('#fff');

Thanks,


Solution

  • I found the answer, It is pretty simple

    $('#bg-color').colpickSetColor('ffffff');
    

    however it wont work properly if written as

    $('#bg-color').colpickSetColor('fff');
    

    or

    $('#bg-color').colpickSetColor('#fff');