Jquery + add checkbox values to href element
<p>Here is what I have:</p>

<pre><code>$(function() { 
    $('#find_1 input[type="checkbox"]').change(function() { 
        var $t = $("#t");
        if ( this.checked )
            $t.append(($t.text()?",":"")+this.value);
        else
            $t.text($t.text().replace(
                  new RegExp("\\b"+this.value+"\\b"), ""
            ));
    }).change();
});
</code></pre>

<p>What I need is to write the checkbox value in the a href of the target #t</p>

<p>For example:</p>

<p>The selected checkboxes:</p>

<pre><code>[x]red

[ ]green

[x]blue
</code></pre>

<p>Should result in a href like this:</p>

<pre><code>&lt;div id"t"&gt;&lt;a href"/colors/red,blue"&gt;preview colors&lt;/a&gt;
</code></pre>

<p>Of course the colors will be added/removed as the user click/unclick the checkboxes.</p>

<p>Thanks for the help.</p>
