jQuery Store Values of checkboxes in div
<p>How can I get this list of checkboxes to be added to a div prior to their selected state, so if they are selected, they should be added to the div, if not they are removed from the list if not selected.</p>

<pre><code>&lt;div id="selected-people"&gt;&lt;/div&gt;

&lt;input type="checkbox" value="45" id="Jamie" /&gt;
&lt;input type="checkbox" value="46" id="Ethan" /&gt;
&lt;input type="checkbox" value="47" id="James" /&gt;
&lt;input type="checkbox" value="48" id="Jamie" /&gt;
&lt;input type="checkbox" value="49" id="Darren" /&gt;
&lt;input type="checkbox" value="50" id="Danny" /&gt;
&lt;input type="checkbox" value="51" id="Charles" /&gt;
&lt;input type="checkbox" value="52" id="Charlotte" /&gt;
&lt;input type="checkbox" value="53" id="Natasha" /&gt;
</code></pre>

<p>Is it possible to extract the id name as the stored value, so the id value will be added to the div instead of the value - the value needs to have the number so that it gets added to a database for later use.</p>

<p>I looked on here, there is one with checkboxes and a textarea, I changed some parts around, doesn't even work.</p>

<pre><code>function storeuser() 
{         
    var users = [];

    $('input[type=checkbox]:checked').each(function() 
    {
        users.push($(this).val());
    });

    $('#selected-people').html(users)
}

$(function() 
{
    $('input[type=checkbox]').click(storeuser);
    storeuser();
});
</code></pre>
