CJCoding With Joseph
15free / daySign inCreate account

Clear a List's Contents

Select 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
Topics:
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.