I have a webpage with less and prefixfree (both of them are js-files, imported from my own server) and now, when I've tried to import a custom script too, I got the problem:
Basic javascript like
x = "hello world";
alert (x);
works fine.
But every code which refers to my document like
alert (document.getElementById("content").innerHTML);
gives the console error
"document.getElementById("content").innerHTML is undefined"
Do you know what the problem could be? Any suggestions how to debug this are also welcome - I'm just despairing!
edit
the JS-files are all imported in the <head>
.
Make sure your javascript is after your markup and make sure the element id
is correct:
<div id="content">Beep boop</div>
<script>
alert(document.getElementById("content").innerHTML);
</script>
Example: http://jsbin.com/sedagite/2/edit