I'm trying to make elements in a list draggable but I'm running into an issue that I can't figure out. My code below follows a general format I've seen in some tutorials.
My list of draggable elements is formatted as such:
function startDrag(e) {
e.dataTransfer.effectAllowed = 'move';
console.debug(e);
e.dataTransfer.setDragImage(e.target, 0, 0);
return true;
}
<ul>
<li class="drag" draggable="true" ondragstart="startDrag(e)"><img src="/my/image/path.svg"></li>
<li class="drag" draggable="true" ondragstart="startDrag(e)"><img src="/my/image/path2.svg"></li>
</ul>
I'm just trying to get the startDrag
function to fire but I keep getting:
Uncaught ReferenceError: e is not defined
This is reproduce-able in my snippet above.
What am I missing here? Thank you!