Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 434 Bytes

set_timeout.md

File metadata and controls

12 lines (9 loc) · 434 Bytes

setTimeOut

Ever created a pop up message like a flash() in Flask and couldn't get rid? This is where setTimeout() comes in. In the below example, I grab the flash message by it's id the toggle a class of hidden on it after a 3 second delay.

setTimeout(() => {
	flash = document.getElementById("flash");
	flash.classList.toggle("hidden");
}, 3000);

Comes in very handy and gives a good error message experience.