I am a trying to use JS to drag an drop nodes on a family tree. However, the nodes will drag, but will not drop where they are placed. They return to their orginal position.
I am not sure if I am defining the area where they can be dropped correctly. The JS code is:
function allowDrop(ev){
ev.preventDefault();
}
function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}
function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("img");
ev.target.appendChild(document.getElementById(data));
}
I then inserted a DIV within a HTML section to allow the drop:
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
Then the HTML code to allow elements to be dragged:
<a title="No Info "draggable="true" ondragstart="drag(event)" href="DiggaDiary1.html" id="shadow" href="#">++ Annie Johnson 1781-(Tuam)</a>
<ul>
Thanks Ciaran