Good afternoon!
Next, I have a div.minhaDiv
with a height: 580px;
and I want it to click on a button
height of that div.minhaDiv
increase to 1600px
.
When it is with height: 1600px
I want it to click on the same button
height to return to 580px
;
Follow HTML
<div class="minhaDiv">
...
</div>
<button onclick="verMais();" class="botao">Ver mais</button>
Javascript
var altura = document.querySelector(".minhaDiv");
function verMais(){
if(altura.style.height <= "580px"){
altura.style.height = "1600px";
document.querySelector(".botao").innerHTML = "Ver menos";
}else{
altura.style.height = "580px";
document.querySelector(".botao").innerHTML = "Ver mais";
}
}
Does anyone know where I'm going wrong? Thanks a lot guys, and it sure is something very basic, I'm learning javascript, thanks!