Toggling checkbox only checks, doesn't uncheck
<p>I am trying to toggle some checkboxes using jQuery and I am using code that is recommended often when searching for toggling checkboxes, but it only seems to check them instead of toggling.</p>

<p>Here's a jsfiddle for it:</p>

<p><a href="http://jsfiddle.net/wgHpG/" rel="nofollow">http://jsfiddle.net/wgHpG/</a></p>

<p>The HTML:</p>

<pre><code>&lt;button id="priority-categories" class="btn"&gt;Priority&lt;/button&gt;

&lt;input type="checkbox" name="category" value="1" id="1"&gt;
&lt;input type="checkbox" name="category" value="2" id="2"&gt;
&lt;input type="checkbox" name="category" value="3" id="3"&gt;​
</code></pre>

<p>The js:</p>

<pre><code>$('#priority-categories').click(function(){

    var categories = [1, 3];

    $.each(categories, function(key, value) {
        $('#' + value).prop('checked', !$('#' + value).checked);
    });
});
</code></pre>
