Get the App
SLTechnology News&Howtos  ›  Development  › 

Characteristics and example introduction of HTML5 drag and drop

Shulou Source: shulou.com Published: 2022-06-03 19:03:03 11月12日 Update

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));}

Tags: Instance feature element data learning support example content attribute standard part facet research difference complexity event location function object that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Redmi OPPO Reno Shulou Information