How do I delete a text node when a button is clicked? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I delete a text node when a button is clicked?

https://code.sololearn.com/WWsM8jajToBX/?ref=app In the process of building a calculated. Right now I’m just trying to get the clear button to work. When number buttons are pressed, text nodes are made that show the numbers on the calculator. When I press clear I want these text nodes removed with the remove child function, but it’s not working. This is around line 27. Any help would be appreciated.

16th Nov 2018, 9:28 PM
Thomas Czernek
Thomas Czernek - avatar
1 Answer
0
function nu (){ document.getElementsByClassName('result')[0].innerHTML = ''; }
16th Nov 2018, 10:30 PM
Ulisses Cruz
Ulisses Cruz - avatar