The dragLeave event fires before drop for HTML5 drag and drop events

JavascriptWeb DevelopmentFront End Scripts

To solve this issue for drag and drop event, dragLeave fires before drop sometimes:

onDragOver = function(e) { e.stopPropagation() }
onDrop = function(e) {
   /* for drop */
}

Under drop, you can set this:

function drop(ev)
{
   event.preventDefault();
   var data=event.dataTransfer.getData("Text");
   event.target.appendChild(document.getElementById(data));
}
raja
Published on 10-Apr-2018 08:45:32
Advertisements