JSFiddle - React, Tailwind, and code Playground
by Checha Man
HTML
<input type="checkbox" value="1" />
<input class="a" type="checkbox" value="2" checked/>
<input class="a" type="checkbox" value="3" />
<input class="a" type="checkbox" value="4" />
<input type="checkbox" value="5" />
<input type="checkbox" value="6" />
<span id="comment"></span>
<br/>
<span id="comento"></span>
<br/>
<span id="details"></span>
JavaScript
/* Checkbox selection by class */
$('#comment').text('Number of checkboxes with class "a" is ' + $('input:checkbox.a').length);
$(".a").click(function (cb) {
var checkered = $('.a:checkbox:checked');
$('#comento').text('Number of checked boxes with class "a" is ' + checkered.length);
var str = "Yolo ";
$.each(checkered, function(key, val){
str = str.concat(val + " ");
});
str = str.concat(" ender");
$('#details').text(str);
});