Open krishnaisdinesh opened 7 years ago
You can use color option in closure:
$('.color').each(function() {
var self = $(this);
var prev_color = '#ff0000';
self.spectrum({
color: prev_color,
palette: [],
preferredFormat: 'hex',
selectionPalette: [],
change: function(color) {
console.log({color, prev_color});
prev_color = color.toHexString();
}
});
});
});
When move event is fired it internaly fire change but after move complete. So we can get old value form selector and while firing event selected colr is passed. Change event first replace the secltor value then new color is passed. So old color is lost.
Is there anyway to get old( before change) color and new both. I am using input color code text box. So it only fires change event. I amnot able to older code.
Is there any option