i’m having a problem when i want to document.getElementById(); in html tag.
example =
<html>
<head>
<script type="js"> //note this example is not found so browser is take time to execution
<script type="js"> //note this example is not found so browser is take time to execution
<script type="js"> //note this example is not found so browser is take time to execution
<script type="js"> //note this example is not found so browser is take time to execution
</head>
<body>
<div> ...
<div id="test">
</div>
</body>
</html>
my question is how to execution document.getElementById("test"); without waiting load script is not found?that can make more time.how i can fix this.thanks for your answer.
note: solve not to remove or modify script to found directory.
just in case,if the script not found.
Add
defer="defer"to those<script />tags for which you want to defer execution.NOTE: defer works on IE and newer versions of Firefox and Chrome