title: get text by class in jquery
body: <p>I want get <code>test</code> inside this example. Why it doesn't work?</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="partTypes"&gt;
      &lt;div class="partType"&gt;
          &lt;div class="details"&gt; &lt;span class="name"&gt;test&lt;/span&gt;
  
          &lt;/div&gt;
          &lt;div class="buttons"&gt;
              &lt;input class="addCart" type="button" value="click me" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JAVASCRIPT</p>
  
  <pre><code>$(document).ready(function () {
      $('input.addCart').live('click', function () {
          var $partType = $(this).closest('div.partType');
          alert($partType.filter('span.name').text());
      });
  });
  </code></pre>