my question is: I have a div with a checkbox and another one with an image, I would like that after the user tags the div with checkbox and click on a commit button, my function in js would check if the checkbox is checked and if it is it compares of the 'id' attribute of the checkbox is equal to the 'value' of the image and if it hides the checkbox and shows the image.
The html is:
<div class="toggle div-inline" style="display: ">
<input type="checkbox" id="consultar_acervo" name="toggle"> <span>Consultar Acervos</span>
<label for="consultar_acervo"></label>
</div>
<div class="column zoom" style="display:none">
<a href="https://siga.ufvjm.edu.br/index.php?module=biblioteca&action=main:pesquisasimples" data-toggle="tooltip" data-placement="top" title="Consultar Acervo" target=“_blank”>
<img src="../images/img_nature.jpg" alt="Fjords" style="width:100%" value="consultar-acervo" id1= "icons">
</a>
<div class="col-sm-1">
<button type="button" class="btn btn-success" id="aplica" onclick="checar()"> Aplicar</button>
The Js file
function checar(){
var checa = document.getElementsByName("toggle");
for (var i=0;i<checa.length;i++){
if (checa[i].checked == true){
// CheckBox Marcado... Faça alguma coisa...
} else {
// CheckBox Não Marcado... Faça alguma outra coisa...
}
}
}