Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed (UPI) Chapter 9: Understanding the Document Object Model (DOM) with JavaScript!
Instruction
Removing Elements
Removing Elements
Elements are removed using the removeChild function. To delete the <p> element from the <div> element in the following example:
<div id="parent">
<p id="child">I'm a child!</p>
</div>
The corresponding JavaScript code is:
// Get elements
const parent = document.getElementById("parent");
const child = document.getElementById("chil...