I want to know if it is correct to use document.getElementById() before the DOM is fully loaded.
I mean, under the definition of the DOM element.
Example:
<html>
<head>...
<body>
<div id="hello">...
...
<script>
document.getElementById('hello')...
</script>
...
I tried it and it works, but I want to know if it's okay to do so.
I am aware that I can listen to the DOM load event and act depending on it, but I don't want to do that if it's not strictly necessary.