0
I’m registering clients and has a checkbox that fills an input with "EXEMPT, leaves it as "READONLY" and needed to fill a combobox with a value that is in options. But I’ve tried everything and I can’t do it, can you give me some light? Follow the code I made.
function IEcli() {
var cbocontribuinte = document.getElementById('tp_contribuinte');
if ($('#iecli').prop("checked")) {
$('#estadual').val("ISENTO");
$('#estadual').attr("readOnly", true);
cbocontribuinte.selectedIndex = 2;
} else {
$('#estadual').val("");
$('#estadual').removeAttr("readOnly");
cbocontribuinte.selectedIndex = 0;
}
}
<label class="col-xs-1 control-label" id="esterg">I. Estadual</label>
<div class="col-xs-2">
<input type="text" class="form-control" name="estadual" id="estadual" placeholder="" value="" />
</div>
<div class="checkbox col-xs-2">
<input type="checkbox" name="iecli" id="iecli" onclick="IEcli()"> Isento?</label>
</div>
</div>
<div class="form-group">
<label class="col-xs-1 control-label">Insc.Municipal</label>
<div class="col-xs-2">
<input type="text" class="form-control" name="nome" placeholder="" value="" />
</div>
<label class="control-label col-xs-1"> Contribuinte </label>
<div class="col-xs-2">
<select class="form-control selectpicker" name="tp_contribuinte" id="tp_contribuinte" onchange="atualizaIEDest();">
<option value="0">Selecione</option>
<option value="1">1 - Contribuinte ICMS</option>
<option value="2">2 - Contribuinte isento de inscrição no cadastro de contribuintes</option>
<option value="9">9 - Não contribuinte, que pode ou não possuir inscrição no cadastro de contribuintes</option>
</select>
</div>
Can you join code to play the example? So we can respond with working code.
– Sergio
Good afternoon Sergio. Of course. I’m putting the code
– Samuel Vincenzo
Sergio, I could only put the snippet, because the code is too big and does not allow saving the question.
– Samuel Vincenzo
I believe that what is missing is to include jquery in your page
– MarceloBoni
Good night, you guys. I would like to thank everyone, all the help worked perfectly, I was using the bootstrap-select.min.js page and it was influencing the code, so it wasn’t working. One question: It is possible to mark all as a valid answer?
– Samuel Vincenzo