JSFiddle - React, Tailwind, and code Playground
HTML
<select multiple id="country">
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
JavaScript
function print_country(country_id)
{
var country_arr = ['Croatia', 'Germany', 'Usa'];
// given the id of the <select> tag as function argument, it inserts <option> tags
var option_str = document.getElementById(country_id);
option_str.length=0;
option_str.options[0] = new Option('Select Country','');
option_str.selectedIndex = 0;
for (var i=0; i<country_arr.length; i++)
{
option_str.options[option_str.length] = new Option(country_arr[i],country_arr[i]);
}
}
print_country('country');