Search & Highlight using JQuery
I need to when the page is loaded , the whole words that match a specific word to be highlighted .
I know I can use id of the div & accordingly highlight the field .

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

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

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


Search & Highlight using JQuery
===

I need to when the page is loaded , the whole words that match a specific word to be highlighted .
I know I can use id of the div & accordingly highlight the field .

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

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

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

