JSFiddle - React, Tailwind, and code Playground
by Divine Chef
HTML
<select name="select" onchange="change(this, 'dpabn2', 'ear2txt');">
<option value="b">Normal</option>
<option value="b">Perforated</option>
<option value="a">Other abnormality</option>
</select><BR>
<div id="dpabn2">
Describe other abnormality:<BR>
<textarea rows="1" cols="40" id="ear2txt" disabled ></textarea>
</div>
JavaScript
function change(selBox,divElem,txtArea) {
for(var i, j = 0; i = selBox.options[j]; j++) {
if(i.value != "b" && selBox.selectedIndex != 0) {
alert(i.value);
document.getElementById(divElem).style.opacity="1.0";
document.getElementById(txtArea).disabled=false;
} else {
document.getElementById(txtArea).disabled=true;
document.getElementById(divElem).style.opacity="0.5";
// selBox.selectedIndex = 0;
}
}
}