function rpsGame() {
var textAnswer = document.createTextNode('You chose a paper');
document.getElementById('this').appendChild("textAnswer");
}
<img id="paper" src="./paper.jpg" height=150 width=150 onclick="rpsGame()"></div>
<div class="answer">
<div id="this"></div>
</div>
</div>
The error I get is:
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
I want it to show the text on the div called this.