// Generate and append Base array from DB based on ID selected
function BasePopulation(id) {
// Use previous query
var array = dropdownRequest.responseJSON[id];
// Create Base dropdown
$("#inputGroup")
.append(
'<div class="col-12 col-sm-12 col-md-8 col-lg-8 col-xl-8 removable">' +
'<select id="BaseSelect" name="BaseSelect" class="selectpicker" data-size="10" data-width="auto" data-container="body" title="Base">' +
'<option>Base</option>' +
'<!-- Populated in .js -->' +
'</select>' +
'</div>'
);
// Populate Base dropdown
$.each(array, function(index, base) {
// Reformat JD Base
var base_value = BaseToValue(base);
$("#BaseSelect")
.append($("<option class='removable'></option>")
.attr("value", base_value)
.text(base));
});
$("#BaseSelect").selectpicker("refresh");
}
I'm trying to reverse the order of the dropdown list in HTML/Javascript, but I can't find a reverse function. Is there a function to do this, or do I have to do this manually?