document ready function if checked

document ready function if checked

The code below is working like it should.
I need to change the first rule so it checks first if it is checked and then continuous.

  1. <script src="http://code.jquery.com/jquery-latest.min.js"
  2.     type="text/javascript"></script>
  3.     <script type="text/javascript">
  4.         $(document).ready(function() { 
  5.          $('table#pl td#cnc').hide(); 
  6.                     
  7.             $('#hide_cnc').click(function() { 
  8.                 if ($(this).attr('checked')) 
  9.                 { 
  10.                     $('table#pl td#cnc').show(); 
  11.                 } 
  12.                 else 
  13.                 { 
  14.                     $('table#pl td#cnc').hide(); 
  15.                 } 
  16.             }); 
  17.         }); 
  18. </script>

I have tried with no succes.:
  1.     <script type="text/javascript">
  2.         $(document).ready(function() {  
  3.                 if ($(this).attr('checked')) 
  4.                 { 
  5.                     $('table#pl td.cnc').show(); 
  6.                 } 
  7.                 else 
  8.                 { 
  9.                     $('table#pl td.cnc').hide(); 
  10.                 } 
  11.                     
  12.             $('#hide_cnc').click(function() { 
  13.                 if ($(this).attr('checked')) 
  14.                 { 
  15.                     $('table#pl td.cnc').show(); 
  16.                 } 
  17.                 else 
  18.                 { 
  19.                     $('table#pl td.cnc').hide(); 
  20.                 } 
  21.             }); 
  22.         }); 
  23. </script>