Getting the state of checkboxes with jQuery

Tagged jquery, checkbox  Languages javascript

The following code will loop through all selected (checked) checkboxes and collect their values in an array:

var selected = [];
$('#select-columns input[@type=checkbox]').filter(':checked').each(function () {
    selected.push(this.value);
});
console.log(selected);

More examples can be found here