JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<script>
function MCComboItem_ToString()
{
var s = '[ ' + this.Label;
if( this.SubItems != null )
{
s += ', ';
for(var i=0 ; i<this.SubItems.length ; i++ )
{
s += this.SubItems[i];
}
}
s += ']';
return s;
}
function MCComboItem( label, value, description, subItems )
{
this.Label = label;
this.Value = value;
this.Description = description;
this.SubItems = subItems;
this.toString = MCComboItem_ToString;
}
function MCAddOption( combo, label, value, isSelected )
{
var oOption = document.createElement('OPTION');
combo.appendChild( oOption );
oOption.innerHTML = label;
oOption.value = value;
if( isSelected != null )
{
oOption.selected = true;
}
}
function MCClearCombo( combo, fillWithEmptyOption )
{
var size = combo.options.length;
for( var i=0 ; i<size ; i++ )
{
combo.removeChild( combo.options[0] );
}
if( fillWithEmptyOption && combo.getAttribute( 'MCEmptyOption' ) != null )
{
MCAddOption( combo, combo.getAttribute( 'MCEmptyOption' ) );
}
}
function MCFillCombo( combo, data, initialValue )
{
var selectedIndex = -1;
if( combo.getAttribute( 'MCDefaultOption' ) != null)
{
MCAddOption( combo,...