clearData method (dataTransfer)
Google Chrome and Safari works similar to the Firefox, the clearData and setData methods can only be called in a handler for the ondragstart event, although the clearData method has no any effect. It seems to be a bug in Google Chrome and Safari. Furthermore the getData method only works for the following drag events in Google Chrome and Safari: ondragenter, ondragover, ondragleave, ondrop. That's why, the dragged data cannot be retrieved by the source element. It seems to be another bug.Note: The dataTransfer object provides support for dragging multiple items in Firefox. You can only access to the first dragged item with the clearData method. To access to multiple items, use the mozClearDataAt method instead.
Optional. String that specifies the data format to clear. If this parameter is not specified, all data formats are cleared.
In Firefox, Google Chrome and Safari, the data format can be an arbitrary string (see the setData method), the types property retrieves the available data formats for the current drag operation. You can use those data formats for this parameter.
There are several data formats (depending on the type of the dragged data) that are available by default for a drag operation in Firefox, Google Chrome and Safari (such as: text/plain, text/html, text/uri-list, text/x-moz-url, application/x-moz-file, etc.). The following list only contains the data formats supported by Internet Explorer.
Supported data formats:
Example HTML code 1:
Did you find this example helpful?