I am using jQuery colorpicker in an application. When a color is selected and selected, the color is displayed in the range class ".swatch". However, when there are two color choices on the same page, span.swatch will display the same color as the color. (see screenshot).
Screenshot here: http://cl.ly/2MUU
Here is the code I'm using
jQuery('.colorselect').ColorPicker({
onSubmit: function ( hsb, hex, rgb, el ) {
jQuery(el).val(hex);
jQuery(el).ColorPickerHide();
},
onBeforeShow: function () {
jQuery(this).ColorPickerSetColor(this.value);
},
onChange: function (hsb, hex, rgb) {
jQuery('.swatch').css('backgroundColor', '#' + hex);
}
})
source
share