title: scrolling to the parent div top with jquery
body: <p>I thought this would be easy.</p>
  
  <p>I have the following HTML</p>
  
  <pre><code>&lt;div&gt;
  &lt;div id="child"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried a couple things</p>
  
  <pre><code>if ($('#child').length){
      $('html, body').animate({scrollTop: $(this).parent().offset().top}, 'slow');
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if ($('.success_div').length){
      pdiv = $(this).parent();
      $('html, body').animate({scrollTop: pdiv.offset().top}, 'slow');
  }
  </code></pre>
  
  <p>error:  TypeError: pdiv.offset(...) is undefined</p>