Uncaught TypeError: Cannot set property 'innerHTML' of null


#1

Anyone else get this error: Uncaught TypeError: Cannot set property 'innerHTML' of null when starting a game?

I think it happened to me when I started using the latest version of choicescript with my old games, and it’s because you need to put <style id="dynamic"></style> in index.html. It wasn’t there before, but now it’s required.

Anyway, if you update your copy of choicescript and get this error, this is how to fix it. Maybe everyone but me just replaces everything but their scenes folder when they update. LOL.

@dfabulich, think it would be good for the code to check if document.getElementById("dynamic") is null and do a head.appendChild() to create it?


#2

Long story short, there’s no need to touch the JavaScript or HTML. Just copy the old mygame folder to a new version to update. That’s it. Anything else is just asking for more trouble.


#3

True, but people might be running into this error and not knowing why it’s happening or how to fix it. It’d be good for the source code to error trap.