1
I’m having trouble changing the Divs I own in HTML.
My idea is that by clicking once, a div is displayed and the other hidden. And if the user clicks again, this div will be hidden and the one that was hidden will be visible. I don’t know what logic I have to apply to this. I thought 2-click event but this is strange because you have to click twice to display the other. It would be if I’m in this, I go to the other and vice versa.
The way I did with the 2 clicks:
var lista1 = document.getElementById('exercicio1e2');
var lista2 = document.getElementById('exercicio3e4')
function mudarExercicios(){
lista1.style.display="flex";
lista2.style.display="none";
}
function mudarExercicio2(){
lista1.style.display="none";
lista2.style.display="flex";
}
and in html my button:
<button class="mudarExercicio" onclick="mudarExercicios()" ondblclick="mudarExercicio2()" >
<i class="fas fa-exchange-alt"></i>
</button>
Someone can give me a light of which way to go?
Where are the elements whose ids are
exercicio1e2
andexercicio3e4
?– Augusto Vasques