The DataTransfer object holds data about the drag and drop operation. This data can be retrieved and set in terms of various attributes associated with the DataTransfer object.
The following are the attributes:
Sr.No. | DataTransfer attributes and their description |
---|---|
1 | dataTransfer.dropEffect [ = value ]
|
2 | dataTransfer.effectAllowed [ = value ]
|
3 | dataTransfer.types Returns a DOMStringList listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files". |
4 | dataTransfer.clearData( [ format ] ) Removes the data of the specified formats. Removes all data if the argument is omitted. |
5 | dataTransfer.setData(format, data) Adds the specified data. |
6 | data = dataTransfer.getData(format) Returns the specified data. If there is no such data, returns the empty string. |
7 | dataTransfer.files Returns a FileList of the files being dragged, if any. |
8 | dataTransfer.setDragImage(element, x, y) Uses the given element to update the drag feedback, replacing any previously specified feedback. |
9 | dataTransfer.addElement(element) Adds the given element to the list of elements used to render the drag feedback. |