im new to javascript and want to fill a div with some text. but it doesn't work.
in the documentation this is the common way to do this. but, why doesn't work this for me?
my code is
Answer
You need to move your script to the end of your HTML. Right now, you're executing the script BEFORE your HTML has been parsed so the document is empty and thus document.getElemntById('mytest')
does not find anything.
See this other answer for a lot more discussion of this issue and other options if you don't want to move your tag:
No comments:
Post a Comment