JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<p>
Total: <span id="total">0</span>
</p>
JavaScript
$('input[type=checkbox]').on('change', function () {
$('#total').text(
$('input[type=checkbox]:checked').length
);
});