Javascript Selecting checkboxes
function checkedCheckboxValues() {
var checkboxes = document.querySelectorAll('input:checked');
var values = [];
if (checkboxes.length) {
Object.keys(checkboxes).forEach(function(key) {
values.push(checkboxes[key].value);
});
}
var checkboxes = document.getElementsByName('districtCheckbox[]');
for (var k in checkboxes) {
if (checkboxes[k].checked) {
values.push(checkboxes[k].value);
}
}
}
var checkboxes = document.querySelectorAll('input:checked');
var cboxes = document.getElementsByName('districtCheckbox[]');
var input = document.querySelector('input[type=checkbox]');
<div class="row">
<div class="small-12 large-8 columns">
<input type="checkbox" name="districtCheckbox[]" value="1">
</div>
</div>
<div class="row">
<div class="small-12 large-12 columns">
<input type="checkbox" name="districtCheckbox[]" value="2">
</div>
</div>
<div class="row">
<div class="small-12 large-12 columns">
<input type="checkbox" name="districtCheckbox[]" value="3">
</div>
</div>