Characteristics and example introduction of HTML5 drag and drop
This article mainly explains the "HTML5 drag-and-drop characteristics and example introduction", the article explains the content is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in-depth, together to study and learn "HTML5 drag-and-drop characteristics and example introduction" bar!
Drag and drop (Drag and drop) is part of the HTML5 standard.
Drag and drop
Drag and drop is a common feature that grabs an object and then drags it to another location.
In HTML5, drag and drop is part of the standard, and any element can be dragged and dropped.
Browser support
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support dragging.
Note: Safari 5.1.2 does not support dragging.
HTML5 drag and drop instance
The following example is a simple drag and drop example:
Function allowDrop (ev) {ev.preventDefault ();} function drag (ev) {ev.dataTransfer.setData ("Text", ev.target.id);} function drop (ev) {ev.preventDefault (); var data=ev.dataTransfer.getData ("Text"); ev.target.appendChild (document.getElementById (data));}