Passing $(this) to function
<p>I'm struggling with implementing this ColorPicker plugin:</p>

<p><a href="http://www.eyecon.ro/colorpicker/" rel="nofollow">http://www.eyecon.ro/colorpicker/</a></p>

<p>I have a form with multiple fields, and I'd like the color picker to pop-up when I select any field, and change the value based on the selection made.</p>

<p>Here is my code:</p>

<pre><code>jQuery(function($) {
    function changeColor(e) {
        e.preventDefault();
        $(this).ColorPicker({
            onChange: function(hsb, hex, rgb) {
                $(this).attr('value', '#' + hex)
            }
        });
    }
    $('form.niceform input').live('mouseup', changeColor);
})
</code></pre>

<p>for some reason though, the $(this).attr... section is not recognizing that $(this) is the currently selected field.</p>

<p>Can someone help me understand what I'm doing wrong?</p>

<p>Thanks!</p>
