title: How to set focus/scrolltop to the first item in the loop?
body: <p>I have a search form, when search button is clicked, it fetches data via ajax request and append into a div. Now, I need to automatically scrolltop to the first result of the search when items returned.How do I do that please?</p>
  
  <p>script to set scrolltop:</p>
  
  <pre><code>$("#search").on("click",function(){
      // Handler for .ready() called.
      $('html, body').animate({
          scrollTop: $('#view2').offset().top//instead of #View2, how do I make the page scrolltop to the first item appended in the for loop below?
      }, 'slow');
  });
  </code></pre>
  
  <p>When search button button clicked, results are fetched by ajax and appended into a div as below:</p>
  
  <pre><code>$("#searchform").on("submit", function () {
      //$(this).find(':submit').attr('disabled','disabled');
      var data = {
          "action": "test"
      };        
  
      $.ajax({
          type: "POST",
          dataType: "json",
          url: "search/ajax2.php",
          data: data,  
          success: function (data) {
              $(".the-inner-return").append("&lt;a href='search2.php?TID="+ tid +"'&gt;")//need to set the scrolltop here
          }
      });
  });
  </code></pre>