I\'m trying to figure out how to run a chunk of code a few seconds after a user presses a submit button on a form. My test page is waiting the right amount of time and properly
Replace
window.addEventListener('submit', timeFunction(), true);
with
window.addEventListener('submit', timeFunction, true);
See the difference between invoking a function and referencing it in my other answer.
Also, instead of doing
setTimeout("handler()", 3000);
which will basically be eval'd when the timeout occurs, you could pass a reference to the handler
function directly to setTimeout. Notice the absence of quotes and the parentheses.
setTimeout(handler, 3000);