title: Failed to execute removeChild on Node
body: <p>Other stack answers such as <a href="https://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node">this</a> and <a href="https://stackoverflow.com/questions/31278307/javascript-failed-to-execute-removechild-on-node-parameter-1-is-not-of-typ">this</a> seem to be specialized cases and I believe my case is more generalized. I am doing this in my js:</p>
  
  <pre><code>var markerDiv = document.createElement("div");
  markerDiv.innerHTML = "&lt;div id='MyCoolDiv' style='color: #2b0808'&gt;123&lt;/div&gt;";
  document.getElementById("playerContainer").appendChild(markerDiv);
  
  // after a brief delay, REMOVE the appended child
  setTimeout(function(){ 
      var myCoolDiv = document.getElementById("MyCoolDiv");
      document.getElementById("playerContainer").removeChild(myCoolDiv);
  }, 1500);
  </code></pre>
  
  <p>Everything works correctly and as expected (the div is correctly appended and I can see it) until <code>removeChild()</code> is called, at which time I get the error <code>Failed to execute 'removeChild' on 'Node'</code>. </p>
  
  <p>What am I doing wrong?</p>