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

ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -

c++ - nodejs socket.io closes connection before upgrading to websocket -

java - What is the equivalent of @Value in CDI world? -