JQuery: Checkbox as radiobutton, without default selection
<p>I have a dynamically generated list, of random length from zero items up, where each item includes by a checkbox. Unlike radio buttons, all of the checkboxes can be unchecked, but like radio buttons only one can <em>be</em> checked. To enforce this, I am using JQuery (based on the answer given here: <a href="http://stackoverflow.com/questions/881166/jquery-checkboxes-like-radiobuttons">jQuery - checkboxes like radiobuttons</a>)</p>

<p>My code as it currently stands is:</p>

<pre><code>var $radiocheck = $('input.radiocheck');
$radiocheck.click(function() {
    if($(this).is(':checked')) {
        $(this).attr('checked', false);
    }
    else if($(this).not(':checked')) {
        $radiocheck.removeAttr('checked');
        $(this).attr('checked', true);
    }
});
</code></pre>

<p>...but it doesn't work (checkboxes remain unchecked on click). Any help is appreciated!</p>
