This works on the first checkbox only.
<input type="checkbox" id="check-filter" name="filter[]" value="<?php echo $filter['filter_id']; ?>" checked="checked" />
<?php echo $filter['name']; ?>
<?php } else { ?>
<input type="checkbox" id="check-filter" name="filter[]" value="<?php echo $filter['filter_id']; ?>" />
<?php echo $filter['name']; ?>
$('#check-filter').on('click', function() { filter = [];
$('input[name^=\'filter\']:checked').each(function(element) {
filter.push(this.value);
});
location = '<?php echo $action; ?>&filter=' + filter.join(',');
});
Aucun commentaire:
Enregistrer un commentaire