MrMastermind Posted September 25, 2007 Share Posted September 25, 2007 Hi, I'm trying to write a function that gets the innerHTML from hidden DIV's to generate a javascript file. After the innerHTML is written to another DIV, I want to delete the div. But somehow I can't get it right. The best I could do was "d.parentNode.removeChild(child);" but that doesn't work. I've tried other approaches, but no luck. Any help would be appreciated: function createJS(){ var d = document.getElementById('eFormOutput'); var children = d.childNodes; var code = ""; for(i=0;i<children.length;i++){ var child = children[i].childNodes[0]; if(child.id.substring(0,2) == "js"){ code += "\n" + child.innerHTML; d.parentNode.removeChild(child); } } document.getElementById("jsOutput").innerHTML += code; } Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.