JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" class="a" id="1">1
<input type="checkbox" class="a" id="2">2
<input type="checkbox" class="a" id="3">3
<input type="checkbox" class="a" id="4">4
<input type="checkbox" class="a" id="5">5
<input type="button" value="Button" id="button">
JavaScript
$("#button").click(function() {
var selected = $(".a:checked").map(function() {
return this.id;
}).get();
alert(selected);
});