asp.net.ph

Skip Navigation Links

clearData Method

DHTML Methods


Removes one or more data formats from the dataTransfer object.

Syntax

bDeleted=window.dataTransfer.clearData ( [ sDataFormat ] ) 
Parameters

sDataFormat Optional. Specifies the data format to remove from the system clipboard using the dataTransfer object. All formats are cleared when no parameter is passed. This string value can be one of the following:

Text Causes the text format to be removed.
URL Causes the URL format to be removed.
File Causes the file format to be removed.
HTML Causes the HTML format to be removed.
Image Causes the Image format to be removed.


Return Value

Boolean. If a legal format is specified when that format is not present, the function returns false. Otherwise, the function returns true.

Remarks

The clearData method of the dataTransfer object is generally used in source events, such as the ondragstart event. When overriding the default behavior of the target, use clearData in the ondrop event.

Example

The example uses the clearData method to strip the text data format from the dataTransfer object.

Sample Code


Applies To

dataTransfer

See Also

Data Transfer Overview, getData, setData



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note