JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" value="1" checked/>
<input type="checkbox" value="2" checked/>
<input type="checkbox" />
<input type="checkbox" />

JavaScript

$(document).ready(function(){
   
    var searchIDs = $('input:checked').map(function(){
        
      return $(this).val();
        
    });
    console.log(searchIDs.get());
    
});