title: search and replace text inside html of div in javascript but not text inside tag
body: <p>I've some HTML structure and i want to search particular text inside that HTML structure.
  see below example</p>
  
  <pre><code>&lt;h1&gt;Try to span some text on this page&lt;/h1&gt;
      &lt;div&gt;
          span is a &lt;span&gt;paragraph&lt;/span&gt;.&lt;/div&gt;
      &lt;p class="span ddd"&gt;This 123is a paragraph.1&lt;/p&gt;
  
  &lt;div class="span ddd"&gt;This is some span in a div element.&lt;/div&gt;
  </code></pre>
  
  <p>Now if I'm searching for "span" text then, "span" word should be wrapped with div tag. 
  But only "span" word in text and not from class or other tags.</p>
  
  <p>i want output like this (wrap using div or span) </p>
  
  <pre><code>&lt;h1&gt;Try to &lt;span class="search"&gt;span&lt;/span&gt; some text on this page&lt;/h1&gt; &lt;div&gt; &lt;span class="search"&gt;span&lt;/span&gt; is a &lt;span&gt;paragraph&lt;/span&gt;.&lt;/div&gt; &lt;p class="span ddd"&gt;This 123is a paragraph.1&lt;/p&gt; &lt;div class="span ddd"&gt;This is some &lt;span class="search"&gt;span&lt;/span&gt; in a div element.&lt;/div&gt;
  </code></pre>