title: remove the child of an element (chess)
body: <p>I am making a chess game, and I need your help to solve the following problem.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>event.target.removeChild(event.target.firstChild);
  dragged.parentNode.removeChild(dragged);
  event.target.appendChild(dragged);
  
  //dragged is ref to the dragged piece
  //event is the drop event</code></pre>
  </div>
  </div>
  </p>
  <p>when I move a piece :</p>
  <ol>
  <li>I remove the existing piece from the square</li>
  <li>I add the new Piece</li>
  <li>If the square is empty I just add the piece</li>
  </ol>
  <p>note: event.target is a square and the pieces are images.</p>
  <p>The problem is when I remove The existing piece from the square, I get the following error:
  Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.</p>