Justin Lachapelle
Justin Lachapelle

Reputation: 61

Microsoft Edge (And IE) Drag Event (JavaScript)

I have a drag event working properly in Chrome/Safari/Firefox/Opera but when running in microsoft edge and IE i get the following error:

SCRIPT438: Object doesn't support property or method 'setDragImage'

Here is my code

function sDrag(e){
            e.dataTransfer.setData('Text', e.target.getAttribute("value"));
            var sample = e.target.getAttribute("sample");
            var imgTemp = document.createElement("img");
            imgTemp.src = "image.png";
            e.dataTransfer.setDragImage(imgTemp, 0, 0);
        }

Upvotes: 2

Views: 3045

Answers (1)

Shilly
Shilly

Reputation: 8589

.setDragImage() is not supported in IE11 and only partially in Edge.

You might have issues with .setData() and .getData() in IE11 as well.

http://caniuse.com/#feat=dragndrop

Upvotes: 2

Related Questions