Hide and Show element after x amount of time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hide and Show element after x amount of time?

button onclick will hide pic. How do I make set the interval to display the image again after x amount of time? https://code.sololearn.com/WdWD2uZwCGfp/#js

26th May 2020, 8:19 PM
njay
njay - avatar
2 Answers
+ 4
Add in your buy function: setTimeout(function(){ x.style.display ='block'; y.style.display = "none"; },2000)
26th May 2020, 8:24 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 1
Thank you, very much appreciated. I can't seem to make the 'item added to cart' div be hidden afterwards though.
26th May 2020, 8:34 PM
njay
njay - avatar