title: Javascript - return dragged image back to its original location
body: <p>I am using the following code to drag images into an area of the screen. I want to know, is there a code that I can use to send the image back to its original location, or at least back to its original div. I need to do this, because after a certain time (lets just say 100s) I need a particular image to go back. So lets say I drag both images into the area, after 100s I want the first image back to its original location</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  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));
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"&gt;&lt;/div&gt;
     &lt;img id="drag1" src="img_logo.gif" draggable="true" ondragstart="drag(event)" width="336" height="69"&gt;
     &lt;img id="drag2" src="img_logo2.gif" draggable="true" ondragstart="drag(event)" width="336" height="69"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>