+ 7
There are 2 main components: 1) What element you want to drag. 2) Where you want to drop it. WHAT ELEMENT TO DRAG: 》Make the element draggable. 》Specify what element is going to be dragged. For this you could use its "id" as data to indicate which element is it. WHERE TO DROP THE ELEMENT: 》Allow an element to become a drop zone (by default elements can't be dropped in other elements, so you must prevent this default behaviour) 》Let the drop zone get the data (the "id") of the dragged element to be able to append the element to it. In short, the element that you want to drag needs to send its id information to the place where it's going to be dropped in order to be recognized 😊 You can read more about it here and find code examples: https://www.w3schools.com/html/html5_draganddrop.asp
23rd May 2018, 9:27 AM
Pao
Pao - avatar