title: Counting the number of DIVs placed into a DIV via drag and Drop
body: <p>I have had a look about the site and found some code and tried it out but its not working in any shape or form. </p>
  
  <p>I am wanting to count the number of DIVs that's placed into another DIV by the user dragging and dropping but only to count the 'correct' ones then if all the correct ones are in the DIV display an alert saying well done then rest the 'game'. Also need to show how many more is needed to go to 'win'. </p>
  
  <p>This is what I have so far: </p>
  
  <p>JS:</p>
  
  <pre><code>    $('.drop').each(function(){ 
          var n = $(this).children('.draggable').length;
          $(".count").text("There are " + n + " divs inside parent box detail.");
          if(n == 2){
          alert("You got them all right! :)");
          }
          });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;div class="foods"&gt;
                &lt;div class="draggable" id="draggable"&gt;&lt;img src="images/fish.png" id="draggable"&gt;&lt;/div&gt;
  
                &lt;div class="draggable" id="draggable"&gt;&lt;img src="images/stone.png"&gt;&lt;/div&gt;
  
                &lt;div class="wrong"&gt;&lt;img src="images/tree.png"&gt;&lt;/div&gt;
              &lt;/div&gt;
  
  &lt;div class="foods"&gt;                
  &lt;div id="droppable" class="drop"&gt;
  &lt;p&gt;Drop here&lt;/p&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="foods"&gt;
          &lt;span class="count"&gt;&lt;/span&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>JS Fiddle of the code: <a href="http://jsfiddle.net/JRLZK/" rel="nofollow">http://jsfiddle.net/JRLZK/</a></p>