I have tried to write some code in JS but, when I hover my mouse, the error "Cannot set property 'innerHTML' of null at ahint" is seen. I have read that such an error can occur because Chrome compiles/renders the JS code before the Div is even created. Therefore, I have put it on the bottom to check it. Unfortunately, putting it on the bottom has not solved my problem. Maybe someone more experienced will understand it.
var hint = "Hello";
function ahint()
{
document.getElementById('#randomhint').innerHTML = hint;
}
<div id="randomhint" onmouseover="ahint()">!</div>
<script type="text/javascript" src="main.js"></script>
</body>