How to dynamically create many Jquery color pickers (eyecon)?
<p>I am using this jQuery color picker for a CMS theme creator: <a href="http://www.eyecon.ro/colorpicker/" rel="nofollow">http://www.eyecon.ro/colorpicker/</a></p>

<p>They are currently set up like this for each color picker:</p>

<pre><code>&lt;div class="colorSelector" id="colorSelector3"&gt;&lt;div style="background-color: #0000ff"&gt;&lt;/div&gt;&lt;/div&gt;
</code></pre>

<p>With this for the javascript:</p>

<pre><code>$('#colorSelector3').ColorPicker({
color: '#0000ff',
onShow: function (colpkr) {
    $(colpkr).fadeIn(500);
    return false;
},
onHide: function (colpkr) {
    $(colpkr).fadeOut(500);
    return false;
},
onChange: function (hsb, hex, rgb) {
    $('#colaAlpha a').css('color', '#' + hex);
    $('#colorSelector3 div').css('backgroundColor', '#' + hex);
}
</code></pre>

<p>});</p>

<p>The problem is I need to create a large amount of color pickers and it would be great to have one function where I pass in the id of the picker and the id of the element/s to be changed. Is this possible?</p>

<p>This didn't work:</p>

<pre><code>function colorPickMulti(itemid, cp){
$(cp).ColorPicker({
color: '#0000ff',
onShow: function (colpkr) {
    $(colpkr).fadeIn(500);
    return false;
},
onHide: function (colpkr) {
    $(colpkr).fadeOut(500);
    return false;
},
onChange: function (hsb, hex, rgb) {
$(itemid).css('color', '#' + hex);
$(cp + ' div').css('backgroundColor', '#' + hex);
}
});
}
</code></pre>

<p>Could I create the functions dynamically some way? Any help would be great! Thanks.</p>
