getaway
getaway

Reputation: 8990

a problem with the jquery color picker?

i have this jquery colorpicker from http://www.eyecon.ro/colorpicker/ , everything is working fine but i dnt seem to know how when the page is loaded i want the colorpicker to be on a default chosen color i.e black

i have a working code http://jsfiddle.net/SpmuV/5/

p.s. the default one is white, but i want to change it to black. thanks for this :))

Upvotes: 0

Views: 4047

Answers (2)

Matthew Vines
Matthew Vines

Reputation: 27561

OK, I misunderstood your question. From your example

http://jsfiddle.net/SpmuV/14/

$(document).ready(function(){


$('#colPick').css('background-color', '#000000');
$("#colPick").ColorPicker({
    color: '#000000',
    onShow: function (colpkr) {
        $(colpkr).fadeIn(500);
        return false;
    },
    onHide: function (colpkr) {
        $(colpkr).fadeOut(500);
        return false;
    },
    onChange: function (hsb, hex, rgb) {
        $('#colPick').css('background-color', '#' + hex);
    }
}); 

});

Ok, notice the OnChange event delegate, your selector is wrong, you need to change it to '#colPick'.

And since we are hard coding the default value to black for the color picker, we can do the same for our selector control with $('#colPick').css('background-color', '#000000');

Upvotes: 2

Luccas
Luccas

Reputation: 4268

Just change the color? color: '#0000ff'-> color: '#000000',

Upvotes: 0

Related Questions