Running into trouble with contentWindow...
To give a bit of some background, I am trying to make a code editor because I want to make something that works offline, but most ides are blocked because it was loaned from the school. I have already found success in creating the parts that take input, and now need to find a way to add the a preview feature. One way that I have noticed was to use the contentWindow property for iFrames. Only problem is that I'm getting some rather weird and unexpected results... Created a separate code that follows nearly the same principle and did not get the same error. The only difference between the two is the overall code size and location of the js code. Normally, I'd put the js code in a script tag in the head or body tag, but for some reason code playground prematurely closes off the script tag for reasons unknown to me. The JavaScript console says that there is a JavaScript SyntaxError: Unexpected end of input Line: 20, but that doesn't make much sense since the function in which I use the contentWindow property has not been called at all when I first run it. The function is supposed to be called when I push a button not immediately. What makes it even worse is that I can see my js code above the rest of the site... Overall I'm at a loss. Can anyone offer advice on alternatives or spot my code for some simple mistake? I could really use a fresh pair of eyes. Thanks. Code with error: https://code.sololearn.com/WEVWtaOaxBg4/#js Smaller scale version that actually works: https://code.sololearn.com/WRa0fTca7Sz1/#html