1
How do I make these rules work at Checkbox?
When Selected "outsourcing" Shows "divOutsourcing", When You Select "audit" Shows "divAuditoriaOptions", When You Select "consulting" Shows "divConsulatoriesOptions"
Remembering that the same options have to disappear, as the Selection is removed.
HTML
<div class="form-group" style="margin: 0 auto;" id="divAreaServico" >
<label for="segmento" class="control-label col-md-1">Segmento:</label>
<div class="col-md-8">
<div class="checkbox" id="segmento">
<label><input type="checkbox" name="outsourcing" value="outsourcing">Outsourcing</label>
<label><input type="checkbox" name="auditoria" value="auditoria">Auditoria</label>
<label><input type="checkbox" name="consultoria" value="consultoria">Consultoria</label>
</div>
</div>
</div>
<div class="form-group" style="margin: 0 auto;" id="divOutsourcing" >
<label for="out" class="control-label col-md-1">Outsourcing:</label>
<div class="col-md-8">
<div class="checkbox" id="outsourcing">
<label><input type="checkbox" name="contabil" value="contabil">Contábil</label>
<label><input type="checkbox" name="financeira" value="financeira">Financeira</label>
<label><input type="checkbox" name="fiscal" value="fiscal">Fiscal</label>
<label><input type="checkbox" name="folhaPagamento" value="folhaPagamento">Folha de Pagamento</label>
</div>
</div>
</div>
<div class="form-group" style="margin: 0 auto;" id="divConsultoriaOpcoes" >
<div class="col-md-8">
<label for="consultoriaOpcoes" class="control-label vForm"> Consultoria:</label>
<input type="text" class="form-control" name="consultoriaOpcoes" id="consultoriaOpcoes" required />
</div>
</div>
<div class="form-group" style="margin: 0 auto;" id="divAuditoriaOpcoes" >
<div class="col-md-8">
<label for="auditoriaOpcoes" class="control-label vForm"> Auditoria:</label>
<input type="text" class="form-control" name="auditoriaOpcoes" id="auditoriaOpcoes" required />
</div>
</div>
Aline, I appreciate the help, but it didn’t work.
– Karina Pinheiro
What didn’t work out?
– Aline
You did, to appear if I select any option. And it would have to be for each option, a Form-group appears. as I explained in the post.
– Karina Pinheiro
Look, I tested it and it’s working. I made a change because a debt was out of parole. But it’s working, yes... For each selected option, a div appears below.
– Aline
Gosh, I made the changes you posted, but it still doesn’t work.
– Karina Pinheiro
You have added jquery?
– Aline
Yes. Just like you posted.
– Karina Pinheiro
I refer to the reference of jquery: https://code.jquery.com/jquery-3.0.js in the header of the page...
– Aline
Yes. I had included it as well. But we have solved it. Thank you for the strength, Aline!!
– Karina Pinheiro