The DataTransfer Object

DataTransfer objects are one of the new objects outlined in the Drag and Drop API. These objects allow us to set and get data about the objects that are being dragged

DataTransfer lets us define two pieces of information.

1. the type of data we’re saving about the draggable element
2. the value of the data itself

By using the setData and getData methods on the dataTransfer object, you can pass data from elements inside our application to other pages of our app, or across browser windows

Dragging data to other applications

snippet
img.ondragstart = function(event) {
event = event || window.event;
// here be one long line
event.dataTransfer.setData('text / plain', 'This is the screen name
for' +this.getAttribute('data - screen_name') + ', whose image can be found here: '+this.src);
};
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 # # # # #