← 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. Usedocument.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>
= newline. No newline after the last line.
Hints2 available
Sign in to use hintsTopics:
HTML DOM
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.