If you are using jQuery 1.5 and below you need to use .attr(). Here it is
1 2 3 4 5 6 7 8 9  | 
 
To check  use  
$('.checkbox').attr('checked','checked');
 
 
To uncheck  use  
$('.checkbox').removeAttr('checked');
 | 
But if you are using jQuery 1.6+ use this code:
1 2 3 4 5 6 7 8 9  | 
 
To check  use  
$('.checkbox').prop('checked', true);
 
 
To uncheck  use  
$('.checkbox').prop('checked', false);
 | 
That’s it 