Append a Paragraph to a Container
mediumQuestion 180Create a new <p> element with the text "New paragraph" and append it inside the empty div with id="box".
Platform-Provided HTML (READ-ONLY):
<div id="box">
</div>Steps:
1. Create the element with document.createElement("p").
2. Set its textContent to "New paragraph".
3. Append it with box.appendChild().
Expected output
<div id="box"> <p>New paragraph</p> </div>
= newline. No newline after the last line.
Hints4 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.