Making Elements Draggable
Enable dragging and handle drag events.
The HTML Drag and Drop API
The native Drag and Drop API lets users grab elements and drop them elsewhere. It is event-driven: source elements fire drag events, and drop targets fire their own. No library required.
The draggable Attribute
By default only links and images are draggable. Add draggable="true" to make any element draggable.
<div draggable="true" id="card">Drag me</div>All lessons in this course
- Making Elements Draggable
- Drop Targets and dataTransfer
- Visual Feedback During Drag
- Dragging Files into the Page