Well, I have 3 select
in my code, being tipo
, outros
and margem
.
When I set the MARGENS
option to select
tipo
select
margem
appears on the screen. Until then everything ok.
However, the options some
and some2
of select
of outros
are hidden.
Does anyone know what I'm doing wrong?
function mostraForm(valor) {
if (valor === "MA") {
document.getElementById("margem").style.display = "block";
document.getElementById("some").style.display = "block";
document.getElementById("some2").style.display = "block";
} else {
document.getElementById("margem").style.display = "none";
document.getElementById("some2").style.display = "none";
document.getElementById("some").style.display = "none";
}
}
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><styletype="text/css">
#margem {
display: none;
}
</style>
<table align="center">
<tr>
<td>
<select name='tipo' onchange="mostraForm(this.value)">
<option value='R$'>R$</option>
<option value='%'>%</option>
<option value='MA'>MARGENS</option>
</select>
<select name='outros'>
<option value='MA'>MARGENS</option>
<option value='so' id="some">some</option>
<option value='so2' id="some2">some2</option>
</select>
</td>
</tr>
<tr id="margem">
<td>
<select name='margem'>
<option value='com'>COMISSÃO</option>
<option value='des'>DESCONTO</option>
<option value='cre'>CRÉDITO</option>
</select>
</td>
</tr>
</table>