
Removing a HTML element
This piece of code shows you how you can use the removeChild method to remove a HTML element from your app. You need to code a parent and a child <div> and set the id attribute of the parent <div>. Then add a JavaScript function that will find the parent <div> and then use the removeChild method and the this keyword to remove the child <div>. Now when the child <div> is clicked, the text about woolly socks will be removed.
See the Pen M3 CS Removing a HTML element by Walker Books UK (@walkerbooks) on CodePen.