JSFiddle - React, Tailwind, and code Playground
HTML
<select id="combo_main" size="4" class="mutiple">
<option>Client Management</option>
<option>User Management</option>
<option>Store Management</option>
<option>Task Management</option>
</select>
JavaScript
$("#combo_main").on(
{"focus": function() {
this.selectedIndex = -1;
}
, "change": function() {
choice = $(this).val();
//console.log('changed!', this, choice);
this.blur();
setTimeout(function() {
alert('Chose ' + choice);
//var newCB = document.createElement("select");
//newCB.id = 'txtT';
var myOptions = [
{'val': "Value 1", 'text': "Text 1"},
{'val': "Value 2", 'text': "Text 2"},
{'val': "Value 3", 'text': "Text 3"}
];
var s = $('<select id="txtT" name="txtT" />');
$(myOptions).each(function(idx, obj) {
//console.log(idx);
//console.log(obj.text);
$("<option />", {value: obj.val, text: obj.text}).appendTo(s);
});
$("body").append(s);
}, 0);
}
});