Shiva
Shiva

Reputation: 12514

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,

Upvotes: 1

Views: 1200

Answers (1)

Shiva
Shiva

Reputation: 12514

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');

Upvotes: 5

Related Questions