Here is jQuery code which I am using .
The color code needs a prepending #
to be used with CSS.
Change
jQuery('#my_txtbox_id').css('background-color',color);
To
jQuery('#my_txtbox_id').css('background-color', '#' + color);
Edit: You can further optimize the code like so:
jQuery(document).ready(function ($) {
$('.jscolor').on('change', function (e) {
var color = $(this).val();
$('#my_txtbox_id').val(color).css('background-color', '#' + color);
});
});