Skip to main content
add() method

Creates a new a new DataTransferItem with the supplied data and adds it to the list.

HTML5 A vocabulary and associated APIs for HTML and XHTML

 

Syntax

var retval = DataTransferItemList.add(data);

Parameters

data

String data:

ValueMeaning
DOMString

The string data

DOMString

The type or format of the data (e.g., MIME type)

 

File data:

ValueMeaning
File

The file data object

 

Return value

Type: DataTransferItem

The newly created data item

Standards information

Remarks

Example usage:


// Add string data
var dataItem1 = itemsList.add(newString, "text/plain");

//Add file data
var dataItem2 = itemsList.add(newFile);

See also

DataTransferItemList