Jquery toggle function problem with checkbox if else statement
<p>I have a Jquery toggle function. I have made an if else statment to fix the bug when a checkbox i pressed directly its got checked and uncheched. Therefor I have maded a else if statement to check if the checkbox have been checked. But now the checkbox does not even get checked onclick. </p>

<p>Here it is live: <a href="http://jsfiddle.net/mvdnj/14/" rel="nofollow">http://jsfiddle.net/mvdnj/14/</a></p>

<p>My Jquery: </p>

<pre><code>categoryDiv.toggle(function () {
    relativeMinimenu.removeClass('hidediv').addClass('someclass').show(200);
    categoryDiv.addClass('clicked').show(200);

    if(   categoryDiv.find('input:checkbox').attr('checked', 'checked') ) { 
        categoryDiv.find('input:checkbox').attr('checked', false);
    } else{
        categoryDiv.find('input:checkbox').attr('checked', 'checked');
    }
}
, function () {
    categoryDiv.removeClass('clicked').find('input:checkbox').prop("checked", false);
    relativeMinimenu.addClass('hidediv');
});
</code></pre>

<p>My HTML:</p>

<pre><code>&lt;div style="margin-top: 81px; width: 200px; float: left; background: none repeat scroll 0% 0% rgb(255, 255, 255);" cxlass="searchbox"&gt;  
&lt;form method="get" action="/" accept-charset="UTF-8"&gt;&lt;div style="margin: 0pt; padding: 0pt; display: inline;"&gt;&lt;input type="hidden" value="✓" name="utf8"&gt;&lt;/div&gt;

        &lt;div id="category" class="menuitem category clicked"&gt;
                &lt;label id="search_Company1_is_true" for="search_Company1"&gt;Company1 &lt;/label&gt;
        &lt;input type="hidden" value="0" name="search[Company1_is_true]"&gt;&lt;input type="checkbox" value="1" name="search[Company1_is_true]" id="search_Company1_is_true" checked="checked"&gt;
        &lt;div class="counter"&gt;1&lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="minimenu" class="someclass"&gt;
        &lt;div class="miniitem"&gt;
         &lt;label for="search_feature1"&gt;feature1&lt;/label&gt;
        &lt;input type="hidden" value="0" name="search[feature1_is_true]"&gt;&lt;input type="checkbox" value="1" name="search[feature1_is_true]" id="search_feature1_is_true"&gt;
        &lt;/div&gt;         &lt;div class="miniitem"&gt;
         &lt;label for="search_feature1"&gt;feature1&lt;/label&gt;
        &lt;input type="hidden" value="0" name="search[feature1_is_true]"&gt;&lt;input type="checkbox" value="1" name="search[feature1_is_true]" id="search_feature1_is_true"&gt;
        &lt;/div&gt;         &lt;div class="miniitem"&gt;
         &lt;label for="search_feature1"&gt;feature1&lt;/label&gt;
        &lt;input type="hidden" value="0" name="search[feature1_is_true]"&gt;&lt;input type="checkbox" value="1" name="search[feature1_is_true]" id="search_feature1_is_true"&gt;
        &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="menuitem category clicked"&gt;
        &lt;label for="search_company2"&gt;company2&lt;/label&gt;
        &lt;input type="hidden" value="0" name="search[company2_is_true]"&gt;&lt;input type="checkbox" value="1" name="search[company2_is_true]" id="search_company2_is_true" checked="checked"&gt;
        &lt;div class="counter"&gt;1&lt;/div&gt;
        &lt;/div&gt;
 &lt;div class="someclass"&gt;
        &lt;div class="menuitem"&gt;
        &lt;/div&gt;
&lt;/div&gt;

    &lt;input type="submit" value="Submit" style="display: none;" name="commit" id="search_submit" class="sdasd"&gt;

&lt;/form&gt;&lt;/div&gt;
</code></pre>
