javascript - Search and highlight the result in all the page -


i know if it's possible highlight word contained in form ?

i have form long text written input , want find word in form , in form.

i started code doesn't search form.

<div id="search_input">     <form action="" id="form_search">         <input style="width: 300px" type="text" placeholder="entrez un mot-clef" id="search">         <button type="button" id="submit_form" onclick="checksearch()" value="submit">rechercher</button>     </form> </div> <script type="text/javascript">     function checksearch() {         var query1 = document.getelementbyid('search').value;         window.find(query1);         return true;     } </script> 

i tried solution posted in commentary getting error : edit :

<div id="search_input">         <form action="" id="form_search">             <input style="width: 300px" type="text" placeholder="entrez un mot-clef" id="search">             <button type="button" id="submit_form" onclick="checksearch()" value="submit">rechercher</button>         </form>     </div> <script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">      function checksearch() {     var src_str = $("#fdescription").html();     var term = document.getelementbyid('search').value;     term = term.replace(/(\s+)/,"(<[^>]+>)*$1(<[^>]+>)*");     var pattern = new regexp("("+term+")", "gi");      src_str = src_str.replace(pattern, "<mark>$1</mark>");     src_str = src_str.replace(/(<mark>[^<>]*)((<[^>]+>)+)([^<>]*<\/mark>)/,"$1</mark>$2<mark>$4");      $("#fdescription").html(src_str);      } </script> 

the error is : uncaught referenceerror: checksearch not defined


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -