drag and drop function w3schools code example Example: drag and drop html function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); }