Firefox Tomorrow

web api instance method

DataTransfer: addElement() method

View on MDN ↗

Limited availability

The DataTransfer.addElement() method sets the drag source to the given element. This element will be the element to which drag and dragend events are fired, and not the default target (the node that was dragged).

[!NOTE] This method is Firefox-specific.

Syntax

addElement(element)

Parameters

  • element
    • : The Element to set as the drag source.

Return value

None (undefined).

Examples

This example shows the use of the addElement() method

function changeDragNode(event, node) {
  const dt = event.dataTransfer;
  dt.addElement(node);
}

Specifications

This method is not defined in any Web standard.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also