this function read the current selected values from a table, I can't get the list of them in a single array readable outside this function.
function getcheckboxed() {
vartoberead = [];
$("input:checkbox[name=test]:checked").each(function(){
vartoberead [vartoberead .length] = $(this).val();
console.log($(this).val(), vartoberead);
return vartoberead;
});
I've declared vartoberead, both inside, than outside the function, tried with:
var myoutsidevar = getcheckboxed();
but always return
[undefined]
Every help is appreciated
vartoberead.push($(this).val());