title: jQuery length failed to validate
body: <p>I have this HTML :</p>
  
  <pre><code>&lt;div id="product_imgfiles_container" class="row"&gt;
      &lt;div class="col-xs-4 col-md-2"&gt;
          &lt;div class="thumbnail product_imgfiles"&gt;
              &lt;img src="./user/product/2016/04/07/2608/0024454001460020491/img/29310931.jpg   "&gt;
              &lt;a href=""&gt;&lt;span&gt;&lt;i class="fa fa-times-circle"&gt;&lt;/i&gt; delete&lt;/span&gt;&lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-xs-4 col-md-2"&gt;
          &lt;div class="thumbnail product_imgfiles"&gt;
              &lt;img src="./user/product/2016/04/07/2608/0024454001460020491/img/29340931.jpg   "&gt;
              &lt;a href=""&gt;&lt;span&gt;&lt;i class="fa fa-times-circle"&gt;&lt;/i&gt; delete&lt;/span&gt;&lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-xs-4 col-md-2"&gt;
          &lt;div class="thumbnail product_imgfiles"&gt;
              &lt;img src="./user/product/2016/04/07/2608/0024454001460020491/img/29311931.jpg   "&gt;
              &lt;a href=""&gt;&lt;span&gt;&lt;i class="fa fa-times-circle"&gt;&lt;/i&gt; delete&lt;/span&gt;&lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and I have this jquery : </p>
  
  <pre><code>$.getJSON("controller/ctrl.dropzonejs-imgfiles.php?dir=XXX",function(json){                         
      $.each( json, function( key, val ) {
          alert (val);
  
          if (!$("#product_imgfiles_container img[src="+val+"]").length){
              alert ("this val not in your HTML yet");
          }
  
      });
  });
  </code></pre>
  
  <p>when there's no IF statement, <code>alert (val);</code> can show all json data. but when I need to validate with <code>.length</code>, it stops the iteration. and I still can't get <code>alert ("this val not in your HTML yet");</code> executed.</p>
  
  <p>how to use <code>.length</code> properly to validate if the src path from json already exist in HTML or not?</p>