We can use the jQuery :check selector in combination with the each() method so as to retrieve the values of all selected checkboxes in a group. The each() method used here simply iterates over all the checkboxes that have been selected/checked.
Let’s give a demonstration of this approach.
The form below presents some favourite sports which we can choose to subscribe to.

Bear in mind that the inputs in the group must have the same name because the syntax to access selected checkboxes looks like
var favorite = [];
$.each($("input[name='sport']:checked"), function(){
favorite.push($(this).val());
});
where ‘sport’ is the name of all checkboxes.
Try this demo version on Plunker.
