title: Jquery scroll to closest element with .class
body: <p><strong>The problem</strong></p>
  
  <p>I have my html page, i am using a search engine like "Ctrl+F" created by me, i integrated a jquery plugin which highlights me all the result i searched for, and it adds the class ".highlight" to the elements it highlights, the thing is i want to scroll between them , each time i press the search button.</p>
  
  <p>I tried this but it didn't work:</p>
  
  <pre><code> $(document).ready(function () {
  
          $("#btnSearch").on("click", function () {
              $('html, body').animate({
                  'scrollTop': $(this).closest(".highlight").position().top
              });
          });
      });
  </code></pre>