Simple: there is no element with an ID of "
container
" so
getElementById
returns
null
, just as it is intended to and as described in the documentation:
Document.getElementById() - Web APIs | MDN[
^]
Why not? That is the question, and not one we can answer - we have no access to your page or it's HTML.
So start by looking at what you think your page contains, and if you don't find the problem there use your browser debug facilities ("Inspect" and "View Source" are a good starting point) to look at where you think
container
should be.
Sorry, but we can't do any of that for you!