HTML and CSS Reference
The drag—and—drop API was originally developed by Microsoft
in IE5.5. Rather than invent an incompatible API, the WHATWG
decided to exhaustively document what IE had implemented.
This has the advantage that the standard mostly works in IE,
but the disadvantage that the API is somewhat more
counterintuitive than most other APIs in the HTML5 spec.
The drag-and-drop API makes use of a few properties and a lot of
events. The following sequence of diagrams gives you an overview of
which events fire when before we dive into code in the following
To perform drag and drop in an html5 page, you need at
least two elements: one to be the element to be dragged
and one to be the drop target.
Element to drag
Needs to have the
set to true .
Element to accept drop
needs to return false to
the ondragover event.