JSFiddle - React, Tailwind, and code Playground

HTML

<div id="screen"></div>
<input type="button" id="foo" value="test" />

JavaScript

var i= -1
while(++i<10){
    $('#screen').append( $('<input/>').attr({"type":"checkbox"}).val(i) )
}

$('#foo').on('click', function(){
var tab = new Array();
$(':checkbox:checked').each(function(){
    tab.push(this.value);
    datastring="selected_action="+tab.join('&selected_action=')
});
alert(datastring)
})