Alen
Alen

Reputation: 917

jQuery Color Picker plugin not working

I installed jQuery plugin Color picker and I don't know how to get selected color so I can change color of my div. I followed instructions in documentation of plugin but with no luck. This is my code:

<div id="colorpickerHolder"></div>
<div id="colorContainer">Test</div>

ColorpickerHolder is div which I use to attach color picker and I made the second div just to test color picker. And in javascript file I have this:

$('#colorpickerHolder').ColorPicker({
    color: '#0000ff',
    onShow: function (colpkr) {
        $(colpkr).fadeIn(500);
        return false;
    },
    onHide: function (colpkr) {
        $(colpkr).fadeOut(500);
        return false;
    },
    onChange: function (hsb, hex, rgb) {
        $('#colorContainer').css('color', '#' + hex);
    }
});

I included all .js files which I found in plugin folder so I don't know where is the problem.

Upvotes: 0

Views: 2319

Answers (1)

falinsky
falinsky

Reputation: 7428

$(document).ready(function(){
    $('#colorpickerHolder').ColorPicker({
        color: '#0000ff',
        onShow: function (colpkr) {
            $(colpkr).fadeIn(500);
            return false;
        },
        onHide: function (colpkr) {
            $(colpkr).fadeOut(500);
            return false;
        },
        onChange: function (hsb, hex, rgb) {
            $('#colorContainer').css('color', '#' + hex);
        }
    });
}

Upvotes: 1

Related Questions