function dragstart_handler(ev) { // Add the target element's id to the data transfer object ev.dataTransfer.setData("text/plain", ev.target.id); ev.dropEffect = "move"; } function drop_handler(ev) { // Get the id of the target and add the moved element to the target's DOM console.log(123) var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); }