Search & Highlight using JQuery
<p>I need to Highlight searched text when the page is loaded , the whole words that match a specific word to be highlighted .</p>

<p>I know I can use id of the div &amp; accordingly highlight the field .</p>

<p>The issue here that I have a complex structure of div<br>
I have found this over Google but this works over "p:"</p>

<pre><code> var str = "test";
      $(function(){
           $('p:contains('+str+')').
               each(function(){
                 var regex = new RegExp(str, "g");
                 $(this).html(
                     $(this).html().
                         replace( regex ,
                                 "&lt;span class='highlight'&gt;"+str+"&lt;/span&gt;"
                                )
               );
           });
     });
</code></pre>

<p>I have tried to mess with this code to loop over div instead , but I couldn't reach a solution </p>
