JavaScript in ASP.NET (edit)
document.getElementById returns null in my javascript code
Rion Williams
function work() { /*...*/ } if (document.readyState == 'loading') { document.addEventListener('DOMContentLoaded', work); } else { work(); }
setTimeout
var delayInMilliseconds = 1000; //1 second setTimeout(function() { //your code to be executed after 1 second }, delayInMilliseconds);
How To Decide When Your Code Should Run
https://eager.io/blog/how-to-decide-when-your-code-should-run/