JSFiddle - React, Tailwind, and code Playground
by George Berkeley
HTML
<form name="formulario">
<select name="select1" onchange="actualizar()">
<option>Escoge un número</option>
<option>uno</option>
<option>dos</option>
<option>tres</option>
</select>
<select id="select2" name="select2">
<option>Opciones</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</form>
JavaScript
window.onload = function()
{
document.formulario.select2.disabled = true;
}
function actualizar()
{
var indices = document.formulario.select1.selectedIndex;
if (indices == 0) x();
if (indices == 1) y();
document.formulario.select2.disabled = false;
}
function x()
{
disabled = document.getElementById("select2").disabled;
if (disabled == false)
{
alert ("SELECT 2 está deshabilitado");
document.getElementById("select2").disabled = true;
}
}
function y()
{
document.getElementById("select2").disabled = false;
}