Ишшо вариант, для разнообразия так скаать
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.0.8/es5-shim.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<div id="result"></div>
</body>
<script>
const el = document.querySelectorAll('input[type=checkbox]');
const result = document.getElementById('result');
function setResult(text){
result.innerText = text
}
var count = 0;
for (var item of el) {
item.addEventListener('change',(e) => {
e.target.checked ? count ++ : count--
let divText = count > 0 ? `Всего чекбоксов: ${count}` : null
setResult(divText)
})
}
</script>
</html>