title: Get index of div with class equal to active
body: <p>I have a twitter bootstrap carousel with :</p>
  
  <pre><code>&lt;div id="myCarousel" class="carousel slide"&gt;
      &lt;div class="carousel-inner"&gt;
         &lt;div class="item"&gt;
              &lt;div id="container"&gt;&lt;/div&gt;
         &lt;/div&gt;
         &lt;div class="item active"&gt;
              &lt;div id="container2"&gt;&lt;/div&gt;
         &lt;/div&gt;
         &lt;div class="item"&gt;
              &lt;div id="container3"&gt;&lt;/div&gt;
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;!-- Controls --&gt;
      &lt;a class="left carousel-control" href="#myCarousel" data-slide="prev"&gt;«&lt;/a&gt;
      &lt;a class="right carousel-control" href="#myCarousel" data-slide="next"&gt;»&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Now when I click on, for ex. a button. I would like to have the index of the item with class = 'active'. In this example it would be the second div, so index = 1 (starts from 0).</p>
  
  <p>To get the div with class = "active" I do this:</p>
  
  <pre><code>var activediv = $('.item').find('.active');
  </code></pre>
  
  <p>But when I want to find the index of the element like this:</p>
  
  <pre><code>var index = activediv.index();
  </code></pre>
  
  <p>I always get "-1" in my console, so he can't find the item ... But why?</p>
  
  <p>Does anyone knows what I'm doing wrong?</p>