title: Cannot read property 'top' of undefined
body: <p>Trying to get the page to scroll to an anchor and I'm getting this error. </p>
  
  <p>Cannot read property 'top' of undefined </p>
  
  <p>Right now I have my JS like the following...</p>
  
  <pre><code>//scroll to section process page
  function scrollToAnchor(aid){
      var aTag = $("div[name='"+ aid +"']");
      $('html,body').animate({scrollTop: aTag.offset().top},'slow');
  }
  
  $("li.menu-item-141 a").click(function() {
     scrollToAnchor('#philosophy-page');
  });
  </code></pre>
  
  <p>Here is my HTML...</p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;div name="philosophy-page" id="philosophy-page"&gt;
      &lt;div class="philosophy-heading"&gt;
          &lt;h1&gt;Philosophy&lt;/h1&gt;
      &lt;/div&gt;&lt;!-- /.philosophy-heading --&gt;
  &lt;/div&gt;&lt;!-- /#philosophy-page --&gt;
  &lt;/div&gt;&lt;!-- /.container --&gt;
  </code></pre>
  
  <p>Any help would be great! </p>
  
  <p>Thank you! </p>