how to check length checkbox has been checked 1

how to check length checkbox has been checked

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

//or
var numberNotChecked = $('input:checkbox:not(":checked")').length;

Here is what the above code is Doing:
1. First, we select all the checkboxes on the page and count them.
2. Then, we select all the checked checkboxes and count them.
3. Finally, we subtract the number of checked checkboxes from the total number of checkboxes.

Similar Posts