i have this jquery script that changes the color of the background instantly by entering a color code into the textbox, the working example is in jsfiddle link below.
http://jsfiddle.net/7jg4e/
but instead of the input field i wanted to use a color picker custom skin, becuase i dont want user to deal with hex code(just like twitter). the jquery plugin im trying to use is found at
http://www.eyecon.ro/colorpicker/
at the buttom of the page it has the neat color picker with DOM element.
so the problem is how am i going to change from the input type to the color picker div. thanks :))
How about:
$('#colorSelector').ColorPicker({
onChange: function(hsb, hex, rgb)
{
$("#full").css("background-color", hex);
}
});
Replace the input element with a div use something like: (untested!)
HTML
<div id='colourPicker'></div>
JS
$('#colourPicker').ColorPicker({
onChange: function(hsb, hex, rgb){
$("#full").css("background-color", '#' + hex);
}
});
There's an example at the bottom of the link you have which shows you how.
Update for changing text
HTML
<div id='colourPickerText'></div>
<div id='textToBeChanged'>Test text</div>
JS
$('#colourPickerText').ColorPicker({
onChange: function(hsb, hex, rgb){
$("#textToBeChanged").css("color", '#' + hex);
}
});
Thanks keithics..
I had the similar problem. I had to call colorpicker for dynamic buttons. I did with taking class instead of id.
It helped me a lot.
$('.colorSelector').ColorPicker({
onChange: function(hsb, hex, rgb,el)
{
$(el).val('#' + hex);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With