I wanted to set a delay on this script but I don’t know how it works. So I would like to ask if someone can help me with a Solution for this/
const el = document.getElementById("search-label"); el.addEventListener("keydown", function(event) { if(event.key === "Enter") { el.blur(); } });
Advertisement
Answer
const el = document.getElementById("search-label"); el.addEventListener("keydown", function(event) { if(event.key === "Enter") { setTimeout(function(){ el.blur(); }, 5000); } });