I want to search and scroll to the location and get the text and changes its color just like Chrome CTRL+F feature (Next and Previous). But it is not on browser window its on div. I tried the following
    <!DOCTYPE html>
<html>
   <head>
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
      <script type="text/javascript">
         function searchText(text){
            var pattern = new RegExp(text,"g");
            var totalMatchCount = ($('#Test').text().match(pattern) || []).length;
            console.log($("div:contains('" + text + "').eq(4)"));
            for(var i=0;i<totalMatchCount;i++){
            if(i==5){
             $('#Test').scrollTop($("div:contains('" + text + "'):eq(5)").offset());
             }
            }
         }
      </script>
   </head>
   <body>
      <div id="Test" style="width: 700px;height: 150px;overflow: scroll;">
         2015-11-05 22:01:00,062                      WARN  [] (Thread-1169 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:02:00,026                      WARN  [] (Thread-1165 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:03:00,049                      WARN  [] (Thread-1180 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:04:00,029                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:05:00,031                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:01:00,062                      WARN  [] (Thread-1169 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:02:00,026                      WARN  [] (Thread-1165 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:03:00,049                      WARN  [] (Thread-1180 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:04:00,029                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:05:00,031                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:01:00,062                      WARN  [] (Thread-1169 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:02:00,026                      WARN  [] (Thread-1165 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:03:00,049                      WARN  [] (Thread-1180 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:04:00,029                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:05:00,031                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:01:00,062                      WARN  [] (Thread-1169 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:02:00,026                      WARN  [] (Thread-1165 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:03:00,049                      WARN  [] (Thread-1180 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:04:00,029                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:05:00,031                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:01:00,062                      WARN  [] (Thread-1169 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:02:00,026                      WARN  [] (Thread-1165 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:03:00,049                      WARN  [] (Thread-1180 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:04:00,029                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
         2015-11-05 22:05:00,031                      WARN  [] (Thread-1185 (-client-global-threads-643998766))<BR> 
      </div>
      <button onclick="searchText('WARN')">Search</button>
   </body>
</html>
In the above code I am searching word WARN and when you click on the button div has to scroll 5th index of the WARN in div. But it's not working as expected.
 
     
     
     
    