CJCoding With Joseph
15free / daySign inCreate account

Move an Element Into Another Container

Move the paragraph with id="item" out of the div with id="source" and into the div with id="target". Appending an existing element to a new parent removes it from its old parent automatically.

Platform-Provided HTML (READ-ONLY):
<div id="source">
  <p id="item">Draggable</p>
</div>
<div id="target">
</div>

Steps:
1. Select both #target and #item.
2. Call target.appendChild(item) — this moves the paragraph into the target.

Expected Output:

<div id="source">
</div>
<div id="target">
  <p id="item">Draggable</p>
</div>

= 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.