
Check or uncheck a checkbox with jQuery is a simple task and can be achieved very easily. If you are using jQuery 1.5 and below you need to use .attr(). Here it is
To check use
$('.checkbox').attr('checked','checked');
To uncheck use
$('.checkbox').removeAttr('checked');
But if you are using jQuery 1.6+ use this code:
To check use
$('.checkbox').prop('checked', true);
To uncheck use
$('.checkbox').prop('checked', false);
That’s it 🙂