I need help figuring out how to make an image disappear on my website after 2 seconds.
I've searched online for solutions, but haven't come across anything helpful.
function rockImage() {
var img = document.createElement("img");
img.src = "rock.png";
var src = document.getElementById("compChoiceImage");
img.setAttribute("width", "100");
src.appendChild(img);
}
I'm hoping to enhance the function above by adding a timer to make the image disappear automatically.