1
I tried to do the checkbox
to change a input
of hidden
for text
, but I don’t know what I’m missing.
function myFunction() {
const selecionado = document.querySelector("#quant");
var checkBox = document.getElementById("ch_quant");
var input = document.getElementById("quant").type = 'hidden';
if (checkBox.checked == true){
document.getElementById("quant").type = 'text'
}
else {
document.getElementById("quant").type = 'hidden'
}
}
<div class="form-group col-md-12">
<label for="nome">Marque P/ Informar Estoque</label>
<input type="checkbox" id="ch_quant" name="ch_quant" required>
<input type="hidden" id="quant" name="quant">
</div>
Where you call that function
myFunction
?– Sergio
said everything not this nowhere, would have how to show me how it would be correct because I am student so I am very new.
– Raphael Filipe
Your question has an answer on this topic: https://answall.com/questions/5563/comorverifica-com-jquery-se-existe-um-checkbox-checado using jQuery.
– Luiz Fernando