โ Back to HTML DOM
Question 140
Append a Paragraph to a Container
Append a Paragraph to a Container
Create 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 withdocument.createElement("p"). 2. Set itstextContentto "New paragraph". 3. Append it withbox.appendChild().
Expected Output:
<div id="box"> <p>New paragraph</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.