JSFiddle - React, Tailwind, and code Playground

HTML

<input name="artist[]" type="checkbox" id="foo">
<input name="artist[]" type="checkbox" id="foo2">
<input name="artist[]" type="checkbox" id="foo3">
<button>click me</button>

JavaScript

$('button').click(function() {
    var artistIDs = $("input[name='artist[]']:checked").map(function(){
        return this.id;
    }).get();
    alert(JSON.stringify(artistIDs));
});