โ Back to HTML DOM
Question 146
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>
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.