MDN self-hosted library · e01.org

DragEvent: dataTransfer property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
function processData(d) {
  // Process the data …
}

dragTarget.addEventListener("dragend", (ev) => {
  // Call the drag and drop data processor
  if (ev.dataTransfer !== null) processData(ev.dataTransfer);
});