I'm currently looping around a series of checkboxes that have a specific name assigned to them. Whatever checkbox is checked it gets the value and puts it in an array.
var filterHeight = $('input[name="filter-height"]:checked');
var userArray = [];
filterHeight.each(function(){
userArray.push($(this).val());
});
So the output could be something like short, medium, tall
How would I assign a key value to the array values? I'm looking to do something like:
$(document).trigger('showHeight', {
short: true,
medium: false,
tall: false
}
});
Any help is appreciated!
userArray[$(this).val()] = true;