CJCoding With Joseph
15per day

Change innerHTML

Select the div with id="contentBox" and replace its innerHTML with a new heading and paragraph.

The new content should be:
- An <h2> with the text "Updated Content"
- A <p> with the text "This was added with innerHTML."

Platform-Provided HTML (READ-ONLY):
<div id="contentBox">
  <p>Original content here.</p>
</div>

Steps:
1. Use document.getElementById() to select the div
2. Use innerHTML to replace all content inside
3. Include both the <h2> and <p> tags in your innerHTML string

Expected Output:

<div id="contentBox">
  <h2>Updated Content</h2>
  <p>This was added with innerHTML.</p>
</div>
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.