JSFiddle - React, Tailwind, and code Playground
by GaryC123
HTML
<select id="ListBox2" onchange="ListBox2_onchange(this)">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<script>
function ListBox2_onchange(listBox2)
{
alert(listBox2.options.length)
var DropDownList1 = document.getElementById('DropDownList1');
for (var i=0; i<listBox2.options.length; i++)
{
if ( listBox2.options[i].selected )
{
var newOption = window.document.createElement('OPTION');
newOption.text = listBox2.options[i].text;
newOption.value = listBox2.options[i].value;
DropDownList1.options.add(newOption);
listBox2.options.remove(i);
}
}
persistOptionsList();
}
</script>