0
How can I make div
change when pressing a button? in case I have 3 buttons, the first one will cause the first one to be displayed div
, the second with which the second div appears and the third cause the third div
.
Something like what it does, but it can only appear one at a time if the div
1, which is the one that keeps appearing by default, appear, 2 and 3 cannot be displayed.
$( "#Clique1" ).click(function() {
$("#opcao1").css("display","block");
});
$( "#Clique2" ).click(function() {
$("#opcao2").css("display","block");
});
$( "#Clique3" ).click(function() {
$("#opcao3").css("display","block");
});
#opcao2{
display:none;
}
#opcao3{
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="opcao1">
Eu apareço
</div>
<div id="opcao2">
Eu irei aparecer se ele sumir
</div>
<div id="opcao3">
Eu também irei aparecer se ele sumir
</div>
<button id="Clique">troca para a opcao1</button>
<button id="Clique2">troca para a opcao2</button>
<button id="Clique3">troca para a opcao3</button>
That’s right, thank you, I’m still layman with javascript. As soon as I give I already mark the answer with correct
– Pedro Henrique Kuzminskas
I get it. You’re welcome :)
– BrTkCa