← Back to HTML DOM
Question 180
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>
= 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.