0
I would like to adapt my JQUERY function so that when unchecking the checkbox "Is crossover" the text field disappears txt_endereco_ocorrencia_02
and out came the field txt_endereco_ocorrencia_numero
, just make the field txt_endereco_ocorrencia_02
appear when clicking the checkbox and the field does not disappear txt_endereco_ocorrencia_numero
, already load disabled field txt_endereco_ocorrencia_02
when opening the form, see below, I believe I will have to change some points:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="jquery/js/jquery-1.9.1.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#esconder_ocorrencia_02").hide();
});
function getval(sel) {
var selecao = sel.value;
if (selecao == "Desligado") {
alert("funcionou");
document.getElementById("#esconder_ocorrencia_02").innerHTML = $("#esconder_ocorrencia_02").show();
} else {
$("#esconder_ocorrencia_02").hide();
}
}
</script>
<tr>
<td><strong>Endereço Ocorrência</strong></td>
<td><input type="text" name="txt_endereco_ocorrencia_01" size="70" />
<strong>Número</strong>
<input type="text" name="txt_endereco_ocorrencia_numero" size="8">
<input type="checkbox" name="chk_cruzamento" id="cruzamento" value="Desligado" onclick="getval(this);">É cruzamento?<br /><br />
<div id="esconder_ocorrencia_02">
<input type="text" name="txt_endereco_ocorrencia_02" size="70"></div>
</td>
</tr>
Thanks for the tip, it worked very well buddy.
– Leandro Azevedo