Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 for appendChild call
javascript
Solution
don't pass a string, but an element
var link = document.createElement('a');
link.innerHTML = imagename;
link.id = "hostname";
link.href = destination;
var specialdiv = document.getElementById("specialdiv");
specialdiv.appendChild(link);
Problem
Possible Duplicate: javascript appendChild doesn't work The error occurs on the last line of this snippet: ``` var anchor = "<a id=\"hostname\" href=\"" + destination + "\"> "+ imagename + "</a>"; var specialdiv = document.getElementById("specialdiv"); console.log("div: " + specialdiv); specialdiv.appendChild(anchor); ``` There's really nothing else going on... I verified that `specialdiv` isn't null or something like that. Can anyone explain why I'm getting this error on that line?