I'm working on a button that should expand when clicked, remove the bottom border, and then restore the bottom border upon collapsing. I've created a function to handle this behavior, where each click increments a counter. The goal is to show the border when the count is divisible by 2. However, despite my code below, it's not functioning as expected.
<script>
function hideBorder() {
var count = 0;
var btn = document.getElementById("chi");
if (btn.onclick) {
count++;
}
if (count % 2 == 0) {
document.getElementById("chi").style.borderBottom = "2px solid #65daff";
document.getElementById("chi").style.borderEndEndRadius = "10px";
document.getElementById("chi").style.borderEndStartRadius = "10px";
} else if (count % 2 == 1) {
document.getElementById("chi").style.borderBottom = "none";
document.getElementById("chi").style.borderEndEndRadius = "0px";
document.getElementById("chi").style.borderEndStartRadius = "0px";
}
}
</script>