1
Hi, I’m developing a website, and I wanted when the user selects the OTHER option, open a text box for him to type, but I’m not getting, someone can help?
function mostraCampo(this) {
var select = document.getElementById('instituição')
if (select == 'OUTRA') {
document.getElementById("outrainst").style.visibility = "visible";
} else{
document.signup.outrainst.style.visibility = "hidden";
}
}
<div class="form-group">
<label> Instituição de ensino <br />
<select class="form-group" name="instituição" id="instituição" onchange="mostraCampo(this.value);">
<option value="UFTM">UFTM</option>
<option value="UNIUBE">UNIUBE</option>
<option value="FACTHUS">FACTHUS</option>
<option value="SENAI">FAZU</option>
<option value="IMEPAC">IMEPAC</option>
<option value="NENHUMA">NENHUMA</option>
<option value="OUTRA">OUTRA</option>
</select>
<input type="text" class="form-control" name="outrainst" id="outrainst" style="visibility: hidden;">
</label>
</div>
Thank you very much, that way it worked!!
– Arthur Oliveira
But why using the if not right, the way I had done?
– Arthur Oliveira
I get it, I just changed the parameter to obj and it worked using if, thank you very much!!!
– Arthur Oliveira