How to get the id of the dragged element in javascript?
问题 I want to get the id of the dragged element in javascript in the drop event handler. div with id place5 is draggable with drop location being another div with id dropArea. In the drop event handler how to get the id of div(place5)? <html> <head> <style> .mainArea{ width: 500px; height : 500px; border-color:red; border-style:solid; border-width:5px; } </style> <script> function dragEventHandler(theEvent) { theEvent.dataTransfer.setData("Text", theEvent.target.id); //Some code here. } function