I would like some help on the element style.display in java script. JS is not changing a div declared in jsp from none, to block. I have a jsp page that has a hidden type div:
<input type="radio" id="ContaForm" name="nuTipoContaR" value="1" checked/> Conta raíz
<input type="radio" id="ContaForm" name="nuTipoContaE" value="2"/> Estrangeira
<br>
</div>
<div id="divInstituicao" style="display:none;">
<div id="divInstituicaoEstrangeira" style="display:none;">
<div class="divlinha">
<div class="linhaLabel"> Instituição:</div>
<div class="divlinhaLabelTexto">
<html:text property="instituicaoEstrangeira" styleId="instituicaoEstrangeira" value="" onkeypress='return trataEnterAspas( event );' onblur="trataCaracteres( this );" onkeyup="trataCaracteres( this );" maxlength="60" size="78" /> <br />
</div>
</div>
</div>
</div>
In javascript my intention is to check if the div is none and if the radio button is clicked, display this div. But it is not going, it even recognizes that the div is none, but in the document.ElementById ("institution"). Style.display="block" The system does not display the div on the jsp screen. Help me please, I'm a beginner and I've done some research, but without success.
$('#form input:radio').bind("click", function() {
if ($(this).is(':checked')) {
var tipoTce = $("input[@name='ContaForm']:checked").value;
tipoConta = parseInt($(this).val());
if(tipoConta == "2"){
var deConta = $("#deContaEstrangeira").val();
var nuContaEstranegira = $("#nuContaEstrangeira").val();
var noContaEstrangeira = $("#noContaEstrangeira").val();
document.getElementById("descMotivo").innerHTML = deMotConta;
document.getElementById("noTipoConta1").value = noContaEstrangeira;
document.getElementById("deTipoConta1").value = deMotConta;
document.getElementById("nuTipoConta1").value = nuContaEstrangeira;
if(document.getElementById("divInstituicao").style.display == "none"){
document.getElementById("divInstituicao").style.display = "block";
}
}
else if(tipoConta =="1"){
retornaTipoContaRaiz();
}
}});