I am working on drag and drop in HTML5 but when I dorp my item I got Uncaught Error: NotFoundError: DOM Exception 8 Any one help me .Please check my code below
<html>
<head>
<script>
function drag(ev)
{
console.log("call drag event method..");
ev.dataTransfer.setData("Text",ev.target.id);
}
function drop(ev)
{
console.log("call drop event method..");
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
function allowDrop(ev)
{
console.log("call allow event method..");
ev.preventDefault();
}
</script>
<body>
<div id="selectedItems" style="overflow-y:scroll">
<button draggable="true" ondragstart="drag(event)">FirstName</button>
<button draggable="true" ondragstart="drag(event)" >FirstName</button>
<button draggable="true" ondragstart="drag(event)" >FirstName</button>
</div>
<div id="selectedItems" ondrop="drop(event)" ondragover="allowDrop(event)">
</div>
</body>
</html>
But I am dropping the button's I got Uncaught Error: NotFoundError: DOM Exception 8 Any one help me