var selected = []; $('#checkboxes input:checked').each(function() { selected.push($(this).attr('name')); });