+ 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