title: jQuery toggleClass to parent class when child has a certain class
body: <p>I'm using the <a href="http://maker.github.com/ratchet/" rel="nofollow">Ratchet</a> framework to prototype iPhone apps.</p>
  
  <p>In Ratchet, they have <a href="http://maker.github.com/ratchet/#toggles" rel="nofollow">toggles</a> that uses the class <code>toggle</code> and onclick (or tap), it uses <code>toggle</code> and <code>active</code>.</p>
  
  <p>Using jQuery, how can I toggle a class to the parent parent element, so when the toggle has the class active, it adds a class (say <code>toggle-active</code>) to the parent parent element and when it doesn't have the class active, it removes have add that class. I've been looking at several different ways such as an if statement, onclick but I haven't found anything that works.</p>
  
  <p>For example, this is what I tried:  </p>
  
  <p>jQuery</p>
  
  <pre><code>$(".toggle.active").click(function() {
      $(this).parent().parent().toggleClass("toggle-active");
  });
  </code></pre>
  
  <p>Markup</p>
  
  <pre><code>&lt;div class="toggle"&gt;&lt;div class="toggle-handle"&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Is <code>toggleClass</code> the problem or is it the function?</p>