CJCoding With Joseph

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