It is necessary to add checked checkboxes to the program array.
var program = []; for(var i=0; i<10; i++) { $('#pre_content5').append('<input type="checkbox" id="checkbox" name = "sam" value = "'+i+'"/>'); }
I know that using jQuery you can select all the checked
$('input:checkbox:checked')
How exactly values of checkboxes fill in an array? Nr when pressing the button.