0

I would like to use this code (example) to have a search option in a webpage. But I would like to have a button next to the input field that lets the user skip thru the results. Can anyone help please?

$('#searchfor').keyup(function(){
         var page = $('#all_text');
         var pageText = page.text().replace("<span>","").replace("</span>");
         var searchedText = $('#searchfor').val();
         var theRegEx = new RegExp("("+searchedText+")", "igm");    
         var newHtml = pageText.replace(theRegEx ,"<span>$1</span>");
         page.html(newHtml);
    });
Eddy
  • 566
  • 2
  • 8
  • 28
  • @mplungjan, this is not a duplicate, because I want to add a button that lets the user skip thru the results in page. – Eddy Jan 10 '17 at 16:45
  • Then this one: http://stackoverflow.com/questions/22487959/search-and-scroll-to-word-on-page – mplungjan Jan 10 '17 at 16:55
  • Seems like a complex story, that I can't figure out. Was hoping for an easier solution. Sincerely, not being lazy. – Eddy Jan 10 '17 at 18:03

0 Answers0