Jquery .each function using show() and hide() not working on last checkbox selected
<pre><code>$(document).ready(function() {
  $('#comparebut').click(function(){
    var id='';
    $("#recomparebut").show();
    $("#comparebut").hide();
    $('input:checkbox').each(function() {

            id = '';
            id = $(this).val();
            //alert(id);
            if($(this).is(':checked'))
            {

                //$('#company_' + id).fadeIn(1500,function() {
                    //$('#company_' + id).show();
                //});
            }
            else{
                $('#company_' + id).fadeOut(1500,function() {
                    $('#company_' + id).hide();
                }); 
            }   
     });

  });
});
</code></pre>

<p>I am trying to hide table rows on a button click event. I am checking the rows based on if a checkbox is selected or not. It works fine but when I have the bottom checkbox selected along with other checkboxes the last table row disappears.</p>
