I have a problem with a Drag and Drop. I have two divs, one where you have images that will be played to another div that has a specific image that can not be moved. But when I give Drop over an image (both in specific and in others) the image disappears, it is food. I ask your help to solve this problem. Here are the >
<body>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)">
<img src="bloco0.png">
</div>
<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)">
<image id="5" class = "bloco" src="bloco1.png" draggable="true" ondragstart="drag(event)">
<image id="6" class = "bloco" src="bloco2.png" draggable="true" ondragstart="drag(event)">
<image id="7" class = "bloco" src="bloco3.png" draggable="true" ondragstart="drag(event)">
<image id="8" class = "bloco" src="bloco4.png" draggable="true" ondragstart="drag(event)">
</div>
<script type="text/javascript" src="js/main.js"></script>
<script>
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("text");
ev.target.appendChild(document.getElementById(data));
}
</script>
</body>