document loaded ang javascript all js ready code example
Example 1: wait for page load js
window.addEventListener('load', function () {
})
//THE OTHER ANSWER IS WRONG (has a syntax error)
Example 2: js dom ready function
<!doctype html>
<html>
<head>
</head>
<body>
Your HTML here
<script>
// self executing function here
(function() {
// your page initialization code here
// the DOM will be available here
})();
</script>
</body>
</html>