I am creating a invoice software in html, css, and javascript. I fetched with document.getElementById(), but in console is showing null value I searched a lot on internet i found that js file is loading earlier than my html file. Please tell solution.
I tried many times but did not succeed
2
Answers
you can try it by giving it between the body and the html closing tag so that your html file loads first then the js file.
If you are using an external script, use the defer attribute:
If you’re using an inline script, use type=module: