My Upvote button starts off transparent, but when I click on it, the background color changes to green. What I need is for the button to become transparent again when clicked a second time. I've attempted using the following code snippet:
function changeColor(){
var upVoteBtn = document.getElementById("upVote");
if (upVoteBtn.style.backgroundColor === "transparent"){
upVoteBtn.style.backgroundColor = "green";
upVoteBtn.style.color = "black";
} else {
upVoteBtn.style.backgroundColor = "transparent";
}
}
<button id="upVote" onclick=changeColor()>upVote</button>