Javascript Handsontable - Uncaught TypeError: Cannot read property 'insertBefore' of undefined

Dub*_*ubb 1 javascript handsontable

I'm using the handsontable library for creating neat tables.
I literally copied the tutorial but the console (web developer console) gives me the following error:

Uncaught TypeError: Cannot read property 'insertBefore' of undefined            
handsontable.full.js:4471 
Run Code Online (Sandbox Code Playgroud)

I link both the .css and the .js file correctly in the <head> tags.

My javascript looks like this:

var data = [
    ["", "Ford", "Volvo", "Toyota", "Honda"],
    ["2016", 10, 11, 12, 13],
    ["2017", 20, 11, 14, 13],
    ["2018", 30, 15, 12, 13]
];

var container = document.getElementById('temp');
var hot = new Handsontable(container, {
    data: data,
    rowHeaders: true,
    colHeaders: true,
    dropdownMenu: true
});
Run Code Online (Sandbox Code Playgroud)

Html:

<div id="temp"></div>
Run Code Online (Sandbox Code Playgroud)

Line 4471 in handsontable.full.js is

rootElement.insertBefore(this.container, rootElement.firstChild);
Run Code Online (Sandbox Code Playgroud)

The table isn't displayed, the error in the console is all I've got.

And*_*zzi 5

It looks like that your

document.getElementById('temp');
Run Code Online (Sandbox Code Playgroud)

return undefined.

Make sure that the container element is still there when Handsontable is constructing.