Mendix does not cope well with setting innerHTML as empty once you rerender the javascript code. Could you try setting it with a ‘space’ or even some text and checking whether it works then?
It is also best practice to create the necessary HTML elements with a widget template HTML file, with something like:
<canvas id="widgetid" class="col-md-10" data-dojo-attach-point="yourDiv"></canvas>
Then, in the widget JS code you can target it with:
this.yourDiv.appendChild(otherDiv)
Also, what -if any- message can you see in the browser console once the container disappears?