Get selected values from a select element with multiple = 'multiple'
function get_selected_values(select_element){
/*
Vanilla JS way of returning an array of selected elements from a
select element with multiple='mulitple'.
Used to allow for multiple Evaluation Categories to be
selected.
*/
var result = [];
var options = select_element && select_element.options;
var opt;
for (var i = 0, i_len = options.length; i < i_len; i++){
opt = options[i];
if (opt.selected){
result.push(opt.value || opt.text);
}
}
return result;
}