I'm trying to append a link to my html-document. It works in JSFiddle but not with a html-document and js-file. Can anyone please se what I'm doing wrong.
fiddle: http://jsfiddle.net/2LcRF/
HTML-code: Javascript Hidden textarea
<body>
<div id="container">
<div id="content">
<p>hello</p>
</div>
</div>
</body>
</html>
JavaScript-code;
var test= document.getElementById("content");
var a = document.createElement("a");
a.href = "#"
var text = document.createTextNode("länk");
a.appendChild(text);
test.appendChild(a);