Answers for "js wait till html has loaded to run"

8

javascript wait for document load

document.addEventListener("DOMContentLoaded", function(event) { 
  //do work
});
Posted by: Guest on May-19-2020
1

how to tell the javascript to wait until the site loads in the html

use the 'defer' keyword
<script type="text/javascript" src="index.js" defer></script>
Posted by: Guest on August-10-2021

Code answers related to "js wait till html has loaded to run"

Code answers related to "Javascript"

Browse Popular Code Answers by Language