button not disabled on unchecking checkboxes +jquery
<p>I have this script that works like charm, except one small details. When all checkboxes are checked, and I click on the button to uncheck them, clickme button remain enabled. I want him disabled then. </p>

<p>Here is my code:</p>

<pre><code>&lt;div id="boxes"&gt;
&lt;input type="checkbox"  name="fruit[]" id="id1"  class="box" value="Banana"&gt; Banana &lt;br /&gt;
&lt;input type="checkbox"  name="fruit[]" id="id2"  class="box" value="Cherry"&gt; Cherry &lt;br /&gt;
&lt;input type="checkbox"  name="fruit[]" id="id3"  class="box" value="Strawberry"&gt; Strawberry &lt;br /&gt;
&lt;input type="checkbox"  name="fruit[]" id="id4"  class="box" value="Orange"&gt; Orange &lt;br /&gt;
&lt;input type="checkbox"  name="fruit[]" id="id5"  class="box" value="Peach"&gt; Peach &lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;div id="chekcAll"&gt;
    &lt;input type="button" id="checkThem" value="Check All Checkboxes"&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;form id="myForm" action="2.php" method="post"&gt; 
&lt;input type="hidden" id="actualvalue" name="actualvalue" /&gt;
&lt;input type="submit" id="groupdelete" value="clickme" disabled ="disabled" /&gt;
&lt;/form&gt;

&lt;script src="jquery-1.7.1.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){

$(function() {
$(".box").click(function(){
    $('#groupdelete').prop('disabled',$('input.checkbox:checked').length &gt; 0);
});
});


$('#checkThem').on('click', function(){
  var $boxes = $("input[type='checkbox']"),
  $unselected = $boxes.not(function(){ 
    return this.checked;
  $('#groupdelete').prop('enabled',$('input.checkbox:checked').length == 0);  // here is my problem
});

// if there are any unselected boxes, it selects all, else it deselects all
 $boxes.prop('checked', $unselected.length &gt; 0);
 $('#groupdelete').prop('disabled',$('input.checkbox:checked').length &gt; 0);   // or    maybe here????  
   })


 $('#checkThem').click(function() {
if ($(this).val() == "Check All Checkboxes") {
  $(this).val("Uncheck All Checkboxes");   
  }
  else {
  $(this).val("Check All Checkboxes");
  }
  });

$("#myForm").submit(function(e) {    
    var names = [];
    $('#boxes').children('input[name="fruit\[\]"]:checked').each(function() {
        names.push($(this).attr("id")); //it better to pass value by using $(this).val()
    });    
    $("#actualvalue").val(names.join(","));
    $(this).children('input[name="fruit\[\]"]').attr('disabled','disabled');
});



});

&lt;/script&gt;
</code></pre>

<p>Anyone can help me to find my mistake??</p>

<p>Regards, Zoran</p>
