title: Finding index within specific selector descendants
body: <p>My simplified scenario:</p>
  
  <pre><code>&lt;div id="container-1" class="container"&gt;
    &lt;div class="content"&gt;
      &lt;div class="item selected"&gt;&lt;/div&gt;
      &lt;div class="item"&gt;&lt;/div&gt;
      &lt;div class="item"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="container-2" class="container"&gt;
    &lt;div class="content"&gt;
      &lt;div class="item"&gt;&lt;/div&gt;
      &lt;div class="item selected"&gt;&lt;/div&gt;
      &lt;div class="item"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I need to find index of class="selected" within class="content" for each class="container", so the expected results for the above scenario would be:</p>
  
  <pre><code>0, 1
  </code></pre>
  
  <p>I'm trying to achieve this with jQuerys 'each' function like so:</p>
  
  <pre><code>$('.container').each(function()
  {
    $(this).find('.item').index('.selected'); 
    $('#' + $(this).attr('id') + ' .item').index('.selected');
    $(this).find('.selected').index();
  });
  </code></pre>
  
  <p>But I'm getting only -1 results.</p>