JSFiddle - React, Tailwind, and code Playground

by jimfrenette

HTML

<select id="wbox" name="listbox" size="20"onchange="call(this)">
<optgroup label="Taxes">
<option value="1694" label="DNA-option1"></option>
    <option value="1642">RNA-option2</option>
</optgroup>
</select>

JavaScript

function call(op) {
    //alert(op.label); 
    //alert(op.name); 
    //alert(op.value); 

    //var x = op.label;
    
    selectedLabel = $("#wbox option:selected").text("label").val();
    alert(selectedLabel);
}