JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" id="1"> <label>First</label><br>
<input type="checkbox" id="2"> <label>Second</label><br>
<input type="checkbox" id="3"> <label>Third</label><br>
<input type="checkbox" id="4"> <label>Forth</label><br>
    <div id='results'></div>

JavaScript

$("input:checkbox").change(function() {
    var someObj = {};
    someObj.showid = [];
    $("input:checkbox").each(function() {
        if ($(this).is(":checked")) {
            $('#results').html('You clicked '+$(this).attr("id"));
           // someObj.showid.push($(this).attr("id"));
        }
    });
    //alert(someObj.showid);
});