how to update a cookie when option is checked
<p>I have a check-list, and I when a user checks the first option I want to get that value. Then, when they checked another option I want to get the second value separately. This is the code I have so far</p>

<pre><code>$('input[type="checkbox"]').live('click', function() {
var values = [];

$('input[type="checkbox"]').each(function(index, value) {
    if (this.checked &amp;&amp; $('input[type="checkbox"]:checked').length == 1) {

            values.push($(this).next().html());
        str1 = values[0];
        number1 = str1.replace(/\D/g,"");
        $('#resultsection p').html("&lt;span&gt;" + number1 + " &lt;/span&gt; ");

    } else if (this.checked &amp;&amp; $('input[type="checkbox"]:checked').length == 2) {

        values.push($(this).next().html());
            str1 = values[0];
            number1 = str1.replace(/\D/g,"");

            str2 = values[1];
            number2 = str2.replace(/\D/g,"");

            $('#resultsection p').html("&lt;span&gt;" + number1 + number2 + " &lt;/span&gt; ");

    } else {

        $('#resultsection p').html("No metrics selected.");
    }
});
</code></pre>

<p>I have spend a lot of time to change this code to make it work, but so far I failed. Can someone tell me what's wrong with this code?
Thanks</p>

<p>Thanks</p>
