Cameron
Cameron

Reputation: 28803

Spectrum colorpicker always shows black

I'm using the spectrum color picker: https://bgrins.github.io/spectrum/

On an input like this:

<input type="text" value="#0000FF" data-color="color_1">

And for my input I have the following JS:

$('[data-color]').spectrum({
    showInput: true,
    preferredFormat: 'hex',
    color: '#0000FF'
});

But neither the default input value or the override in my JS code are being used as the selected color. It ALWAYS shows as black.

Here is a fiddle showing it happening:

https://jsfiddle.net/4vgmh97L/3/

The console logs show that the spectrum value and input value are different... but should be the same... any ideas what's going on?

Upvotes: 1

Views: 567

Answers (0)

Related Questions