count checked checkbox jquery code example

Example 1: How to check whether a checkbox is checked in jQuery?

//using plane javascript 
if(document.getElementById('on_or_off_checkbox').checked) {
    //I am checked
} 

//using jQuery
if($('#on_or_off_checkbox').is(':checked')){
    //I am checked
}

Example 2: count number of checkboxes in html jquery

var numberOfChecked = $('input:checkbox:checked').length;
var totalCheckboxes = $('input:checkbox').length;
var numberNotChecked = totalCheckboxes - numberOfChecked;

Example 3: jquery checkbox checked

$("checkbox").is(":checked")

Example 4: jquery checkbox checked

$("#general_no").prop( "checked", true);

Example 5: is checked checkbox jquery

$('#' + id).is(":checked")

Example 6: How to check checked checkbox in jquery

$('.myCheckbox').prop('checked', true);
$('.myCheckbox').prop('checked', false);