title: jQuery scrollTop() method not working
body: <p>I have the following jQuery code</p>
  
  <pre><code>$(document).ready(function () {
      $('.navtoTop').click(function(){
             $("html").scrollTop( $("#topofthePage").offset().top );
      }); 
  });
  </code></pre>
  
  <p>where 'navtoTop' is the class of the button(something like 'Back to top') which has the fixed position in the bottom-left of the page and 'topofthePage' is the id of the <code>&lt;div&gt;</code> at the most top of my page.</p>
  
  <p>I have even tried this</p>
  
  <pre><code>$('.navtoTop').click(function(){
      $('html, body').animate({scrollTop : 0},800);
      return false;
  });
  </code></pre>
  
  <p>Here is the html code</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="topofthePage"&gt;&lt;/div&gt;
      ...
      ...
      &lt;img src="navtoTop.png" class="navtoTop"&gt;   
  &lt;/body&gt;
  </code></pre>
  
  <p>I don't know what is going wrong but this is not working. Will someone explain and give a good solution? </p>
  
  <p>Ask me the detail of code if you want.</p>