Drop not working?

I’m trying to get HTML5 DnD working.
I can drag but not drop. Why?
What am i missing out?

Fiddle:
https://jsfiddle.net/un4e4rqn/

HTML

<div class="well" id="columns">
  <section id="drop_element" ondrop="drop(event)" ondragover="allowDrop(event)"></section>
</div>
<div class="col-md-2 well" id="lista_objekt">
  <section id="drag_element">
    <ul>
      <li class='elements' id='888' draggable='true' ondragstart='drag(event)'>222</li>
    </ul>
  </section>
</div>

JS

function allowDrop(ev){
  ev.preventDefault();
}
function drag(ev){
  ev.dataTransfer.setData("Text",ev.target.id);
}
function drop(ev){
  ev.preventDefault();
  var data = ev.dataTranfer.getData("Text");
  ev.target.appendChild(document.getElementById(data));
}

CSS

#drop_element {
  height: 200px;
  width: 200px;
  border: 3px solid activeborder;
}
.elements:hover {
  color: red;
}


Source: html5

Leave a Reply