Menu
Horje
Hi !
Welcome,
Guest
Close Menu
Home
Web Tutorial
HTML Drag and Drop API
What browsers will support HTML Drag and Drop
How to create HTML Drag and Drop Example
How to Make an Element Draggable
What to Drag - ondragstart and setData()
Example of ondragstart and setData()
Where to Drop - ondragover
How to Do the Drop - ondrop
How to drag and drop an image from left to right
Home
Web Tutorial
Full Course
English Tutorial
HTML
HTML Drag and Drop API
Example of ondragstart and setData()
Example of ondragstart and setData()
In this case, the data type is "text" and the value is the id of the draggable element ("drag1").
index.html
Example:
HTML
<script> function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); } </script>
Try Now
Output should be:
Next
Previous
Type
:
html
Category
:
Web Tutorial
Sub Category
:
HTML Drag and Drop API
Uploaded by
:
Admin