1

How can I add checkbox values into an array using jQuery? because this doesn't seem to work:

var fields2 = $("#tblMondayTimes input: checked").serializeArray();                     
var DansArray = new Array();
var BookableTimes = $.each(fields2, function(i, field){
DansArray[field.value];
});

Any ideas?

1 Answers1

0
var DansArray = [];
$("#tblMondayTimes input:checked").each(function() {
    DansArray.push($(this).val()); //push each val into the array
});
Gideon
  • 18,251
  • 5
  • 45
  • 64