title: Checking if dragged div is in right place
body: <p>I want to check if image is in right place after drop. It alerts "wrong" all the time. Dunno why.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"&gt;&lt;/div&gt;
  &lt;div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"&gt;&lt;/div&gt;
  &lt;div id="div3" ondrop="drop(event)" ondragover="allowDrop(event)"&gt;&lt;/div&gt;
  &lt;div id="div4" ondrop="drop(event)" ondragover="allowDrop(event)"&gt;&lt;/div&gt;
  &lt;div id="div5" ondrop="drop(event)" ondragover="allowDrop(event)"&gt;&lt;/div&gt;
  
  &lt;img id="drag1" src="img/patternslowo1.png" draggable="true" ondragstart="drag(event)"&gt;
  &lt;img id="drag2" src="img/patternslowo2.png" draggable="true" ondragstart="drag(event)"&gt;
  &lt;img id="drag3" src="img/patternslowo3.png" draggable="true" ondragstart="drag(event)"&gt;
  &lt;img id="drag4" src="img/patternslowo4.png" draggable="true" ondragstart="drag(event)"&gt;
  &lt;img id="drag5" src="img/patternslowo5.png" draggable="true" ondragstart="drag(event)"&gt;
  </code></pre>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>function allowDrop(ev)
  {
    ev.preventDefault();
  }
  
  function drag(ev)
  {
    ev.dataTransfer.setData("content",ev.target.id);
  }
  
  function drop(ev)
  {
    ev.preventDefault();
    var image =ev.dataTransfer.getData("content");
    ev.target.appendChild(document.getElementById(image));
  
    if (ev.dataTransfer.getData('div1') == 'drag1'){ 
       alert("ok");
    }
    else{
       alert("wrong");
    }
  }
  </code></pre>
  
  <p>Few hours trying to fix it and nothing.</p>
  
  <p>You can check example on <a href="http://jsfiddle.net/ruddog2003/YbM2X/" rel="nofollow">fiddler</a></p>