Clear a List's Contents
mediumQuestion 186Select the list with id="todos" and remove all of its items by setting its innerHTML to 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 with document.getElementById().
2. Set its innerHTML to "" (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.