Tuesday 6 January 2015

Add on drop event to a div javascript

You need to enable dropping on the target element. Add the ondragover attribute to your div like this:
<div id="bin" ondrop="drop(event)" ondragover="allowDrop(event)">
    <img src="icono.png" style="width:100px; margin-left:500px;display:inline;"/><p>
</div>
and an allowDrop function such as this:
function allowDrop(e) {
    e.preventDefault();
}
http://stackoverflow.com/questions/21999030/add-on-drop-event-to-a-div-no-jquery