โ Back to HTML DOM
Question 16
Remove an Element
Remove an Element
Select the paragraph with id="removeMe" and remove it from the page. Platform-Provided HTML (READ-ONLY): <div id="content"> <p id="removeMe">This paragraph will be removed.</p> <p>This paragraph stays.</p> </div> Steps: 1. Use document.getElementById() to select the paragraph 2. Use the .remove() method to delete it from the DOM
Expected Output:
<div id="content"> <p>This paragraph stays.</p> </div>
Topics:
HTML DOM
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.