I have the following:
Element.prototype.makeDraggable = (elem = null) => {
//this.draggable = true;
this.setAttribute("draggable", "true");
this.ondragstart = (e) => { e.dataTransfer.setData("text", elem ? elem.id : e.target.id); }
};
When the browser gets to that function it throws an error on the first line:
Drag.js:7 Uncaught TypeError: n.setAttribute is not a function
Where n
is the minified name of the element, or so I thought.
as you can see in the picture, this
seems to be an Element
, but n
is.. well I don't know what it is. Am I doing it wrong?
At this same point, if I do this.draggable = true
in the console it works just fine... You can also see that I tried doing it in the code but that doesn't work either.
Any ideas?