← Back to HTML DOM
Question 186
Clear a List's Contents
Clear a List's Contents
Select the list with id="todos" and remove all of its items by setting itsinnerHTMLto an empty string. The<ul>itself must remain. Platform-Provided HTML (READ-ONLY):<ul id="todos"><li>Task 1</li><li>Task 2</li></ul>Steps: 1. Select the list withdocument.getElementById(). 2. Set itsinnerHTMLto "" (an empty string).
Expected Output:
<ul id="todos"></ul>= 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.