i made this button but it dosen't work at first click. it is work when i clicked twice;; is there anything that i miss? or something wrong? any help will be so appreciated :) thanks!
function myFunction99() {
var gwbtn = document.getElementById("discountbigbox");
var gwbtnbig = document.getElementById("discountprice");
if (gwbtn.style.height === "0px") {
gwbtn.style.height = "210px";
gwbtnbig.style.border = "1px solid black";
gwbtnbig.style.color = "black";
} else {
gwbtn.style.height = "0px";
gwbtnbig.style.border = "1px solid #cccccc";
gwbtnbig.style.color = "#999";
}
}
#discountbigbox {width:100%;
height:0px;
overflow:hidden;
text-align:left;
background-color: #f7f9ff;
margin-bottom:20px;
transition: all 0.5s ease;
font-size:13px;
margin-top:45px;
}
#discountprice { border: 1px solid #cccccc;
width: fit-content;
float: right;
padding: 0px 10px;
border-radius: 4px;}
#discountprice:hover { border: 1px solid black;
color:black;}
<div id="discountprice" onclick="myFunction99()" > + click this button</div>
<div id="discountbigbox">
<p>test</p>
</div>