title: jquery how to remove a instance of a div if 2 are present?
body: <p>this question sounds a bit confusing, but here is what i have:</p>
  
  <pre><code>&lt;div id="type2"&gt;
  &lt;img class="profile-img" src="75.jpg"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>after i click on something it becomes like this:</p>
  
  <pre><code>&lt;div id="type2"&gt;
  &lt;img class="profile-img" src="75.jpg"&gt;
  &lt;img class="profile-img" src="76.jpg"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>what i want is to remove the first <code>img</code> instance if two are present.
  basically to become:</p>
  
  <pre><code>&lt;div id="type2"&gt;
  &lt;img class="profile-img" src="76.jpg"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>i've tryed:</p>
  
  <pre><code>    if (item.lenght == 2) {
  $('#type2').find('.profile-img:first').remove();
  }
  </code></pre>
  
  <p>but it doesn't seem to work
  thanks</p>
  
  <p>edit:</p>
  
  <p>thanks all. this answer is what worked for me from shifty:</p>
  
  <pre><code>if ($('#type2').find('.profile-img').size() &gt;= 2) {
  $('#type2').find('.profile-img:first').remove();
  }
  </code></pre>
  
  <p>i did misspelled the <code>length</code> but still didn't want to work :)</p>