Showing new letters after the button is clicked.
Change MouseEvent to more general Event.
If the button is in the letterpile, the mouse click handler moves the button to the end of the word.
If the button is in the word, the mouse click handler moves the button back to the letter pile.

To move the button from the letter pile to the word or back, the code simply adds the button to a DOM element that is different from the button’s current parent. Because an element can have only one parent, adding the button to a different parent automatically removes it from its previous parent.