โ Back to HTML DOM
Question 150
Move an Element Into Another Container
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#targetand#item. 2. Calltarget.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.