JSFiddle - React, Tailwind, and code Playground
by bryiantan
HTML
<select id="down">
<option value="">select</option>
</select>
<select id="down2">
<option value="">select</option>
</select>
JavaScript
var temp = {"1" : "string1","2" : "string2"};
var $select = $('#down');
$select.find('option').remove();
$.each(temp,function(key, value)
{
$select.append('<option value=' + key + '>' + value + '</option>');
});
var misteryObject ={"A" : "string A","B" : "string B"};
var $select2 = $('#down2');
$select2.find('option').remove();
$.map( misteryObject, function( value, key ) {
$select2.append('<option value=' + key + '>' + value + '</option>');
// return '';
});