Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM
Exercise: Drag and Drop
Implement drag and drop functionality for dinosaurs between enclosures.
Task
The index.html file has two paddocks (.enclosure) and dinosaur cards with the draggable="true" attribute. On dragstart each card stores its id in dataTransfer. Fill in the blanks: ___BLANK1___ is the event a paddock receives while a dragged card is over it (preventDefault() there allows the drop), and ___BLANK2___ is the dataTransfer method that reads the stored id in drop. A dropped card should end up in the paddock it was dropped on.