I have to find the id of draggable div in drop function using javascript. Using Jquery i know how to find it. but i am stuck in one condition where id of the dragged event is necessary in drop function. In drag function I am able to get id by using alert("id "+obj.id) but please help me out to find this in drop function using javascript.
Here is the code
function allowDrop(ev)
{
ev.preventDefault();
}
function drag(ev, obj)
{
ev.dataTransfer.setData("Text",ev.target.id);
alert("id "+obj.id)
}
function drop(ev)
{
farea1[i] = x[0].getElementsByTagName("termTxt")[i].getAttribute("correctCat");
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
i++;
display();
if(ev.target.id == "area1"){
fans1[n]=farea1[k];
k++;
n++;
countarea1++;
}
}
Use this function to find the droppable id