JSFiddle - React, Tailwind, and code Playground

by anubhavranjan

HTML

<input type="checkbox" value="1" checked="checked" class="first" name="first[]">
<input type="checkbox" value="2" checked="checked" class="first" name="first[]">
<input type="button" class="btn" value="Go">

JavaScript

$(".btn").on("click",function () {
    var ffirst = $('input:checkbox[name="first[]"]:checked').map(function () {
        return this.value;
    }).get();
    alert(ffirst);
});