What is the best way to temporarily hide an element and then have it reappear after a second?
var targetElement = document.getElementById("myElement");
targetElement.onclick = function() {
this.style.display = "none";
setTimeout(function(){
targetElement.style.display = "block";
}, 1000);
}
I am successfully hiding the element, but it's not reappearing as expected. Can anyone point out what might be wrong with my code?