Reputation: 2123
I just got into javascript today but I can't figure out how to load it into my website. I've been looking everywhere for a solution but nothing seems to help.
This is my body in index.html
<body>
<p id="testid">TEST</p>
<script type="text/javascript" src="./script.js"></script>
</body>
This is some example java script code I grabbed off the internet, I tried other examples as well but I can't get anything to work.
<script type="text/javascript">
var para = document.createElement("p");
var node = document.createTextNode("This is new.");
para.appendChild(node);
var element = document.getElementById("testid");
element.appendChild(para);
</script>
The html and javascript file are both in the same folder, I'm clueless as to why this won't work... I appreciate any help :)
Upvotes: 0
Views: 84